__CAPGO_KEEP_0__
このプラグインのインストール手順と全マークダウンガイドを含む設定の質問をコピーします。
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.
インストール
「インストール」のセクションbun add @capgo/capacitor-audio-sessionbunx cap syncインポート
「インポート」のセクションimport { AudioSession } from '@capgo/capacitor-audio-session';API Overview
APIの概要currentOutputs
__CAPGO_KEEP_0__の現在の出力現在のアクティブなオーディオ出力ルートを取得します。
ウェブとiOS以外のプラットフォームでは、空の配列に解決されます。
import { AudioSession } from '@capgo/capacitor-audio-session';
await AudioSession.currentOutputs();overrideOutput
__CAPGO_KEEP_0__のオーバーライド現在のオーディオ出力ルートをオーバーライドします。
を使用して、ビルトインスピーカーを強制的に再生するか、 speaker システムによって選択されたルートを復元する
default コピー
import { AudioSession } from '@capgo/capacitor-audio-session';
await AudioSession.overrideOutput({} as OutputOverrideType);Type Reference
「Type Reference」セクション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ビルトインスピーカーを通じて再生します。
export type OutputOverrideType = 'default' | 'speaker';OverrideResult
「OverrideResult」セクションオーバーライド要求の結果。
export type OverrideResult = { success: boolean; message: string;};RouteChangeListener
ルート変更リスナー音声ルートが変更されたときに呼び出されるリスナー。
export type RouteChangeListener = (reason: RouteChangeReasons) => void;InterruptionListener
中断リスナー音声セッションが中断されたり終了したときに呼び出されるリスナー。
export type InterruptionListener = (type: InterruptionTypes) => void;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',}真実の源
真実の源This page is generated from the plugin’s src/definitions.tspublic APIがアップストリームで変更された場合に再度syncを実行してください。
Getting Startedから続けてください。
「Getting Startedから続けてください。」というセクションCapacitorを使用している場合 Getting Started Capacitorを使用してネイティブメディアとインターフェイスの動作を計画するには、 Using @capgo/capacitor-audio-session Using @capgo/capacitor-audio-sessionのネイティブ機能を使用するには Using @capgo/capacitor-live-activities Using @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 に