メインコンテンツにジャンプ
プラグインに戻る
@capgo/capacitor-media-session
チュートリアル
@capgo/capacitor-media-session

メディア セッション

ロック画面と通知センターからメディア再生を制御

ガイド

Media Sessionのチュートリアル

使用中:@capgo/capacitor-media-session

Capacitor プラグインを使用してデバイスのメディアセッション制御を公開する

Install

bun add @capgo/capacitor-media-session
bunx cap sync

What This Plugin Exposes

  • setMetadata - Sets metadata of the currently playing media.
  • setPlaybackState - Updates the playback state of the media session.
  • setActionHandler - Registers a handler for a media session action.
  • setPositionState - Updates position state for the active media session.

Example Usage

setMetadata

Sets metadata of the currently playing media.

import { MediaSession } from '@capgo/capacitor-media-session';

await MediaSession.setMetadata({} as MetadataOptions);

setPlaybackState

Updates the playback state of the media session.

import { MediaSession } from '@capgo/capacitor-media-session';

await MediaSession.setPlaybackState({} as PlaybackStateOptions);

setActionHandler

Registers a handler for a media session action.

import { MediaSession } from '@capgo/capacitor-media-session';

await MediaSession.setActionHandler({} as ActionHandlerOptions, {} as ActionHandler | null);

setPositionState

Updates position state for the active media session.

import { MediaSession } from '@capgo/capacitor-media-session';

await MediaSession.setPositionState({} as PositionStateOptions);

Full Reference

Keep going from Using @capgo/capacitor-media-session

__CAPGO_KEEP_0__を使用している場合 Using @capgo/capacitor-media-session APIと接続してください capgoの実装詳細については、@capgo/capacitor-media-sessionを参照してください for the implementation detail in @capgo/capacitor-media-session, Getting Startedの実装詳細については、Getting Startedを参照してください Capgoの概要 API APIの実装詳細については 概要 __CAPGO_KEEP_0__の実装詳細については APIのキー APIの実装詳細については