はじめから
このプラグインのセットアッププロンプトをコピーします。インストール手順とフルマークダウンガイドが含まれます。
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-audio-session`, `@capgo/capacitor-audiosession`
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/audiosession/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-Assistedセットアップを使用してプラグインをインストールできます。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-audio-session` plugin in my project.Manual Setup を使用する場合は、以下のコマンドを実行してください。プラットフォーム固有の指示は下記を参照してください。
bun add @capgo/capacitor-audio-sessionbunx cap syncImport
「Import」セクションimport { AudioSession } from '@capgo/capacitor-audio-session';API の概要
「API の概要」セクションcurrentOutputs
「currentOutputs」セクション現在のアクティブなオーディオ出力ルートを取得します。
On web and non-iOS platforms, this resolves to an empty array.
import { AudioSession } from '@capgo/capacitor-audio-session';
await AudioSession.currentOutputs();overrideOutput
overrideOutputセクション現在のオーディオ出力ルートを上書きします。
使用 speaker ビルトインスピーカーを強制的に使用するか、
default システムが選択したルートを復元する
import { AudioSession } from '@capgo/capacitor-audio-session';
await AudioSession.overrideOutput({} as OutputOverrideType);型リファレンス
型リファレンスセクションAudioSessionPorts
オーディオセッションポートiOS上の利用可能なオーディオ出力ルート
export enum AudioSessionPorts { AIR_PLAY = 'airplay', BLUETOOTH_LE = 'bluetooth-le', BLUETOOTH_HFP = 'bluetooth-hfp', BLUETOOTH_A2DP = 'bluetooth-a2dp', BUILT_IN_SPEAKER = 'builtin-speaker', BUILT_IN_RECEIVER = 'builtin-receiver', HDMI = 'hdmi', HEADPHONES = 'headphones', LINE_OUT = 'line-out',}OutputOverrideType
「OutputOverrideType」のセクション出力オーバーライドの種類 defaultシステムが選択したルートを使用します。 speakerビルトインスピーカーを通じて再生を強制します。
export type OutputOverrideType = 'default' | 'speaker';OverrideResult
「OverrideResult」のセクション出力オーバーライドの要求の結果
export type OverrideResult = { success: boolean; message: string;};RouteChangeListener
「RouteChangeListener」のセクションオーディオルートが変更されたときに呼び出されるリスナー
export type RouteChangeListener = (reason: RouteChangeReasons) => void;InterruptionListener
「InterruptionListener」音声セッションが中断されたり終了したときに呼び出されるリスナーです。
export type InterruptionListener = (type: InterruptionTypes) => void;RouteChangeReasons
「RouteChangeReasons」export enum RouteChangeReasons { NEW_DEVICE_AVAILABLE = 'new-device-available', OLD_DEVICE_UNAVAILABLE = 'old-device-unavailable', CATEGORY_CHANGE = 'category-change', OVERRIDE = 'override', WAKE_FROM_SLEEP = 'wake-from-sleep', NO_SUITABLE_ROUTE_FOR_CATEGORY = 'no-suitable-route-for-category', ROUTE_CONFIGURATION_CHANGE = 'route-config-change', UNKNOWN = 'unknown',}InterruptionTypes
「InterruptionTypes」export enum InterruptionTypes { BEGAN = 'began', ENDED = 'ended',}真実の源
「真実の源」このページはプラグインの src/definitions.ts公開 API がアップストリームで変更されたときに再度 Sync を実行してください。
「Getting Started」から続きます
「Getting Started」から続けてあなたが使用している Getting Started ネイティブメディアとインターフェイスの動作を計画する場合 「@capgo/capacitor-audio-session」 「@capgo/capacitor-audio-session」 「@capgo/capacitor-live-activities」 「@capgo/capacitor-live-activities」 「@capgo/capacitor-live-activities」 「@capgo/capacitor-video-player」 「@capgo/capacitor-video-player」 「@capgo/capacitor-video-player」 @capgo/capacitor-video-player @capgo/capacitor-video-player