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-recorder`
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/audio-recorder/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.
インストール
InstallAI-Assisted Setupを使用してプラグインをインストールすることができます。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-recorder` plugin in my project.Manual Setupを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の指示に従ってください。
bun add @capgo/capacitor-audio-recorderbunx cap syncImport
Importimport { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';API 在给一个回算的给果为屿生的简三中文给果为屿生的简三
Section titled “API Overview”startRecording
回算的给果为屿生的简三中文给果为屿生的简三帮一给果的回算四常用给果的回算四常用给果的回算四
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.startRecording();pauseRecording
回算的给果为屿生的简三中文给果为屿生的简三Pause the ongoing recording. Only available on Android (API 24+), iOS, and Web.
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.pauseRecording();resumeRecording
帮一给果的回算四常用给果的回算四常用给果的回算四回算的给果为屿生的简三中文给果为屿生的简三
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.resumeRecording();stopRecording
回算的给果为屿生的简三中文给果为屿生的简三現在の録音を停止し、記録した音声を保存します。
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.stopRecording();cancelRecording
セクション “cancelRecording”現在の録音をキャンセルし、記録した音声を破棄します。
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.cancelRecording();getRecordingStatus
セクション “getRecordingStatus”現在の録音の状態を取得します。
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.getRecordingStatus();getCurrentAmplitude
セクション “getCurrentAmplitude”マイクの入力レベルを、0 から 1 の範囲で表した正規化された数値で取得します。 [0, 1] 録音中にライブビジュアライゼーションとしてVUメーターまたは波形を表示するために使用します。
戻り値 0 __CAPGO_KEEP_0__の録音が有効になっていない場合に使用します。
UIレートポーリング用に設計されています — 60–100 msの間隔は、波形の良い出発点です。
それを緊急ループ内で呼び出すのを避けます;各呼び出しはJS/ネイティブ橋を渡ります。
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.getCurrentAmplitude();checkPermissions
「checkPermissions」セクションマイクへのアクセスを許可するために現在の許可状態を返します。
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.checkPermissions();requestPermissions
「requestPermissions」セクションマイクへのアクセスを許可するために許可を求めます。
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.requestPermissions();型参照
「型参照」セクションStartRecordingOptions
「StartRecordingOptions」セクション.に渡されるオプション
export interface StartRecordingOptions { /** * The audio session category options for recording. Only available on iOS. * * @since 1.0.0 */ audioSessionCategoryOptions?: AudioSessionCategoryOption[];
/** * The audio session mode for recording. Only available on iOS. * * @since 1.0.0 */ audioSessionMode?: AudioSessionMode;
/** * The audio bit rate in bytes per second. * Only available on Android and iOS. * * @since 1.0.0 */ bitRate?: number;
/** * The audio sample rate in Hz. * Only available on Android and iOS. * * @since 1.0.0 */ sampleRate?: number;}StopRecordingResult
セクション「録音終了結果」. から返される結果
export interface StopRecordingResult { /** * The recorded audio as a Blob. Only available on Web. * * @since 1.0.0 */ blob?: Blob;
/** * The duration of the recording in milliseconds. * * @since 1.0.0 */ duration?: number;
/** * The URI pointing to the recorded file. Only available on Android and iOS. * * @since 1.0.0 */ uri?: string;}GetRecordingStatusResult
セクション「録音ステータス取得結果」. から返される結果
export interface GetRecordingStatusResult { /** * The current recording status. * * @since 1.0.0 */ status: RecordingStatus;}GetCurrentAmplitudeResult
セクション「現在の振幅取得結果」. から返される結果
export interface GetCurrentAmplitudeResult { /** * The current input amplitude normalized to the `[0, 1]` range, where `0` * represents silence and `1` represents the maximum level the platform can * report. The value is `0` when no recording is active. * * Note: the source signal differs between platforms — Android reports the * peak sample amplitude since the last call, iOS reports the average power * in dB converted to linear, and Web reports the RMS of the latest frame. * Consumers that need cross-platform parity may want to apply a * per-platform scaling curve. * * @since 8.1.0 */ value: number;}PermissionStatus
セクション「許可状況」および から返される許可情報
export interface PermissionStatus { /** * The permission state for audio recording. * * @since 1.0.0 */ recordAudio: PermissionState;}RecordingErrorEvent
「レコーディングエラーイベント」のセクションレコーディング中にエラーが発生したときに発行されるイベント。
export interface RecordingErrorEvent { /** * The error message. * * @since 1.0.0 */ message: string;}RecordingStoppedEvent
「レコーディングストップイベント」のセクションレコーディングが完了したときに発行されるイベント。
export type RecordingStoppedEvent = StopRecordingResult;AudioSessionCategoryOption
「オーディオセッションカテゴリオプション」のセクションiOSで利用可能なオーディオセッションカテゴリオプション。
export enum AudioSessionCategoryOption { AllowAirPlay = 'ALLOW_AIR_PLAY', AllowBluetooth = 'ALLOW_BLUETOOTH', AllowBluetoothA2DP = 'ALLOW_BLUETOOTH_A2DP', DefaultToSpeaker = 'DEFAULT_TO_SPEAKER', DuckOthers = 'DUCK_OTHERS', InterruptSpokenAudioAndMixWithOthers = 'INTERRUPT_SPOKEN_AUDIO_AND_MIX_WITH_OTHERS', MixWithOthers = 'MIX_WITH_OTHERS', OverrideMutedMicrophoneInterruption = 'OVERRIDE_MUTED_MICROPHONE_INTERRUPTION',}AudioSessionMode
「オーディオセッションモード」のセクションiOSで利用可能なオーディオセッションモード。
export enum AudioSessionMode { Default = 'DEFAULT', GameChat = 'GAME_CHAT', Measurement = 'MEASUREMENT', SpokenAudio = 'SPOKEN_AUDIO', VideoChat = 'VIDEO_CHAT', VideoRecording = 'VIDEO_RECORDING', VoiceChat = 'VOICE_CHAT',}RecordingStatus
「レコーディングステータス」のセクションレコーディングのステータス
export enum RecordingStatus { Inactive = 'INACTIVE', Recording = 'RECORDING', Paused = 'PAUSED',}PermissionState
「パーミッションステート」のセクションCapacitorでサポートされるプラットフォームパーミッションの状態
export type PermissionState = 'prompt' | 'prompt-with-rationale' | 'granted' | 'denied';真実の源
「真実の源」のセクションこのページはプラグインの src/definitions.tsAPIの公開バージョンがアップストリームで変更された場合に再度Syncを実行してください
Getting Startedから続けてください
「Getting Started」から続けて」あなたが「Getting Started」を使用している場合 Getting Started native mediaとinterface behaviorを計画するには、__CAPGO_KEEP_0__/__CAPGO_KEEP_1__-audio-recorderと接続する native capabilityのcapgo/capacitor-audio-recorderの使用 native capabilityのcapgo/capacitor-live-activitiesの使用 native capabilityのcapgo/capacitor-live-activities native capabilityのcapgo/capacitor-live-activitiesの実装詳細 native capabilityのcapgo/capacitor-video-playerの使用 native capabilityのcapgo/capacitor-video-playerの使用 native capabilityのcapgo/capacitor-video-playerの実装詳細 native capabilityのcapgo/capacitor-video-playerの実装詳細 @capgo/capacitor-video-player @capgo/capacitor-video-player