Skip to content

はじめから

GitHub

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-session
bunx cap sync
import { AudioSession } from '@capgo/capacitor-audio-session';

API の概要セクション

Section titled “API Overview”

Copy to clipboard

ウェブと非iOSプラットフォームでは、この値は空の配列に解決されます。

import { AudioSession } from '@capgo/capacitor-audio-session';
await AudioSession.currentOutputs();

Override the current audio output route.

Use speaker to force playback through the built-in speaker, or default to restore the system-selected route.

import { AudioSession } from '@capgo/capacitor-audio-session';
await AudioSession.overrideOutput({} as OutputOverrideType);

Available audio output routes on 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',
}

出力オーバーライドの種類 default: システムが選択したルートを使用 speaker: 内蔵スピーカーを通じて再生する

export type OutputOverrideType = 'default' | 'speaker';

出力オーバーライドの結果

export type OverrideResult = {
success: boolean;
message: string;
};

音声ルートの変更を検知するリスナー

export type RouteChangeListener = (reason: RouteChangeReasons) => void;

リスナーは、音声セッションが中断されたり終了したときに呼び出されます。

export type InterruptionListener = (type: InterruptionTypes) => void;
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',
}
export enum InterruptionTypes {
BEGAN = 'began',
ENDED = 'ended',
}

このページはプラグインの src/definitions.tsパブリック API がアップストリームで変更されたときに、再度同期を実行してください。

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-live-activities」の実装詳細 「@capgo/capacitor-video-player」を使用 「@capgo/capacitor-video-player」を使用してネイティブ機能を接続 @capgo/capacitor-video-player for the implementation detail in @capgo/capacitor-video-player.