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-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セットアップを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。"
bun add @capgo/capacitor-audio-sessionbunx cap syncインポート
「インポート」セクションimport { AudioSession } from '@capgo/capacitor-audio-session';API オーバービュー
「API オーバービュー」セクションcurrentOutputs
「currentOutputs」セクション現在使用中のアクティブなオーディオ出力ルートを取得します。
ウェブおよびiOS以外のプラットフォームでは、空の配列に解決されます。
import { AudioSession } from '@capgo/capacitor-audio-session';
const result = await AudioSession.currentOutputs();console.log(result);overrideOutput
「overrideOutput」セクション現在のオーディオ出力ルートをオーバーライドします。
使用 speaker iOS内蔵スピーカーを強制的に使用するか、または
default システムが選択したルートを復元するか
import { AudioSession } from '@capgo/capacitor-audio-session';
const result = await AudioSession.overrideOutput('default');console.log(result);型参照
「型参照」セクションAudioSessionPorts
「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: iOS内蔵スピーカーを強制的に使用する
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
「中断タイプ」セクションexport enum InterruptionTypes { BEGAN = 'began', ENDED = 'ended',}真実の源
「真実の源」セクションこのページはプラグインの src/definitions.tsパブリック API がアップストリームで変更された場合に再度 Sync を実行してください。
「Getting Started」から続けてください
「Getting Started」から続けてください「Getting Started」を使用して ネイティブメディアとインターフェイスの動作を計画する場合、 「@__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-audio-session」を使用して接続してください @capgo/capacitorオーディオセッションを使用 native機能の使用に@capgo/capacitor-オーディオセッションのために native機能の使用に@capgo/capacitor-ライブアクティビティ native機能の使用に@capgo/capacitor-ライブアクティビティのために @capgo/capacitor-ライブアクティビティ 実装詳細の@capgo/capacitor-ライブアクティビティのために native機能の使用に@capgo/capacitor-ビデオプレーヤー native機能の使用に@capgo/capacitor-ビデオプレーヤーのために @capgo/capacitor-ビデオプレーヤー native機能の使用に@capgo/capacitor-ビデオプレーヤー、