始め方
Copy a setup prompt with the install steps and the full markdown guide for this plugin.
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.
Install
Section titled “Install”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-recorder` plugin in my project.手動セットアップを使用する場合は、以下のコマンドを実行してプラグインをインストールし、以下のプラットフォーム固有の説明を参照してください:
bun add @capgo/capacitor-audio-recorderbunx cap syncImport
Section titled “Import”import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';API の概要
「API の概要」というセクションstartRecording
「startRecording」というセクションデバイスのマイクを使用して音声の録音を開始します。
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.startRecording();pauseRecording
「pauseRecording」というセクション進行中の録音を一時停止します。Android (API 24+)、iOS、Web では利用可能です。
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.pauseRecording();resumeRecording
「resumeRecording」というセクション前回一時停止した録音を再開します。
import { CapacitorAudioRecorder } from '@capgo/capacitor-audio-recorder';
await CapacitorAudioRecorder.resumeRecording();stopRecording
「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] Copy to clipboard
録音中のライブビジュアライゼーション、VUメーターまたは波形などに使用することを意図しています。
レコーディングが開始されていない場合に返します。
UIレートのポーリングに設計されています。
波形の場合、60-100msの間隔が良く始まるポイントです。
緊急ループ内で呼び出すことを避けるようにしてください。
各呼び出しはJS/ネイティブブリッジを渡ります。 0 __CAPGO_KEEP_0__
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」__CAPGO_KEEP_0__
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
__CAPGO_KEEP_1____CAPGO_KEEP_0__
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
__CAPGO_KEEP_2____CAPGO_KEEP_0__
export interface GetRecordingStatusResult { /** * The current recording status. * * @since 1.0.0 */ status: RecordingStatus;}GetCurrentAmplitudeResult
__CAPGO_KEEP_3____CAPGO_KEEP_0__
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
__CAPGO_KEEP_4____CAPGO_KEEP_0__と__CAPGO_KEEP_1__から取得される許可情報。
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から続けてください」Capgoを使用している場合 Getting Started nativeメディアとインターフェイスの動作を計画するには、Capgoを @capgo/capacitor-audio-recorderを使用してnative機能を接続する @capgo/capacitor-audio-recorderのnative機能を使用する場合に@capgo/capacitor-audio-recorderを使用する @capgo/capacitor-live-activitiesを使用する @capgo/capacitor-live-activitiesのnative機能を使用する場合に@capgo/capacitor-live-activitiesを使用する @capgo/capacitor-live-activities @capgo/capacitor-live-activitiesの実装詳細を参照する @capgo/capacitor-video-playerを使用する native capabilityを使用する@capgo/capacitor-video-playerのために、 @capgo/capacitor-video-player native capabilityの実装詳細を@capgo/capacitor-video-playerに記載するために、