Getting Started
Copy a setup prompt with the install steps and the full markdown guide for this plugin.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-media-session`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/media-session/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
インストール
「インストール」のセクションCapgoのAIアシストセットアップを使用してプラグインをインストールできます。AIツールにCapgoスキルを追加するには、以下のコマンドを使用してください。
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins次に、以下のプロンプトを使用してください。
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-media-session` plugin in my project.Manual Setupを使用する場合は、以下のコマンドを実行してプラットフォーム固有の指示を参照してください。
bun add @capgo/capacitor-media-sessionbunx cap syncImport
「Import」セクションimport { MediaSession } from '@capgo/capacitor-media-session';APIの概要
「APIの概要」セクションsetMetadata
「setMetadata」セクション現在再生中のメディアのメタデータを設定します。
import { MediaSession } from '@capgo/capacitor-media-session';
await MediaSession.setMetadata({} as MetadataOptions);setPlaybackState
「setPlaybackState」セクションメディアセッションの再生状態を更新します。
import { MediaSession } from '@capgo/capacitor-media-session';
await MediaSession.setPlaybackState({} as PlaybackStateOptions);setActionHandler
「setActionHandler」セクションメディアセッションのアクション用ハンドラを登録します。
import { MediaSession } from '@capgo/capacitor-media-session';
await MediaSession.setActionHandler({} as ActionHandlerOptions, {} as ActionHandler | null);setPositionState
「setPositionState」セクションアクティブなメディアセッションの位置状態を更新します。
import { MediaSession } from '@capgo/capacitor-media-session';
await MediaSession.setPositionState({} as PositionStateOptions);Type Reference
タイプ参照セクションMetadataOptions
メタデータオプションセクションexport interface MetadataOptions { album?: string; artist?: string; artwork?: MediaImage[]; title?: string;}PlaybackStateOptions
再生状態オプションセクションexport interface PlaybackStateOptions { playbackState: MediaSessionPlaybackState;}ActionHandlerOptions
アクションハンドラオプションセクションexport interface ActionHandlerOptions { action: MediaSessionAction;}ActionHandler
アクションハンドラセクションexport type ActionHandler = (details: ActionDetails) => void;PositionStateOptions
位置状態オプションセクションexport interface PositionStateOptions { duration?: number; playbackRate?: number; position?: number;}MediaImage
メディアイメージセクションexport interface MediaImage { src: string; sizes?: string; type?: string;}MediaSessionPlaybackState
「MediaSessionPlaybackState」セクションexport type MediaSessionPlaybackState = 'none' | 'paused' | 'playing';MediaSessionAction
「MediaSessionAction」セクションexport type MediaSessionAction = | 'play' | 'pause' | 'seekbackward' | 'seekforward' | 'previoustrack' | 'nexttrack' | 'seekto' | 'stop';真実の源
「真実の源」セクションこのページはプラグインの src/definitions.tsAPIがアップストリームで変更された場合に再度同期する
Getting Startedから続けて
「Getting Startedから続けて」セクションあなたが使用している場合 バーターコンター to plan dashboard and API operations, connect it with Using @capgo/capacitor-media-session for the native capability in Using @capgo/capacitor-media-session, API Overview for the implementation detail in API Overview, バサイゲトをコンターだ。 バサイゲトをコンターだ。バラトショナをコンターだ。 API Keys for the implementation detail in API Keys, and バサイゲトをコンターだ。バラトショナをコンターだ。 バサイゲトをコンターだ。バラトショナをコンターだ。