Getting Started
このプラグインのセットアッププロンプトとインストールステップ、そしてフルマークダウンガイドを含むコピー可能なプロンプトを取得します。
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セットアップを使用する場合は、次のコマンドを実行して、以下のプラットフォーム固有の指示に従ってください。
bun add @capgo/capacitor-media-sessionbunx cap syncImport
「Import」のセクションimport { MediaSession } from '@capgo/capacitor-media-session';setMetadata
Section titled “setMetadata”Section titled “メディアのメタデータを設定します”
import { MediaSession } from '@capgo/capacitor-media-session';
await MediaSession.setMetadata({} as MetadataOptions);setPlaybackState
Section titled “setPlaybackState”Section titled “メディアセッションの再生状態を更新します”
import { MediaSession } from '@capgo/capacitor-media-session';
await MediaSession.setPlaybackState({} as PlaybackStateOptions);setActionHandler
Section titled “setActionHandler”Section titled “メディアセッションのアクションハンドラーを登録します”
import { MediaSession } from '@capgo/capacitor-media-session';
await MediaSession.setActionHandler({} as ActionHandlerOptions, {} as ActionHandler | null);setPositionState
Section titled “setPositionState”Section titled “アクティブなメディアセッションの位置状態を更新します”
import { MediaSession } from '@capgo/capacitor-media-session';
await MediaSession.setPositionState({} as PositionStateOptions);型リファレンス
「型リファレンス」のセクション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
「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.tsパブリックAPIがアップストリームで変更されたときに再度同期してください。
「Getting Started」から続けてください
「Getting Started」から続けてあなたが「{0}」を使用している場合 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 デバイス デバイスの実装詳細について