@independo/capacitor-voice-recorder
Version:
Capacitor plugin for voice recording
41 lines • 1.62 kB
JavaScript
import { VoiceRecorderImpl } from '../platform/web/VoiceRecorderImpl';
/** Web adapter that delegates to the browser-specific implementation. */
export class VoiceRecorderWebAdapter {
constructor() {
/** Browser implementation that talks to MediaRecorder APIs. */
this.voiceRecorderImpl = new VoiceRecorderImpl();
}
/** Checks whether the browser can record audio. */
canDeviceVoiceRecord() {
return VoiceRecorderImpl.canDeviceVoiceRecord();
}
/** Returns whether the browser has microphone permission. */
hasAudioRecordingPermission() {
return VoiceRecorderImpl.hasAudioRecordingPermission();
}
/** Requests microphone permission through the browser. */
requestAudioRecordingPermission() {
return VoiceRecorderImpl.requestAudioRecordingPermission();
}
/** Starts a recording session using MediaRecorder. */
startRecording(options) {
return this.voiceRecorderImpl.startRecording(options);
}
/** Stops the recording session and returns the payload. */
stopRecording() {
return this.voiceRecorderImpl.stopRecording();
}
/** Pauses the recording session when supported. */
pauseRecording() {
return this.voiceRecorderImpl.pauseRecording();
}
/** Resumes a paused recording session when supported. */
resumeRecording() {
return this.voiceRecorderImpl.resumeRecording();
}
/** Returns the current recording state. */
getCurrentStatus() {
return this.voiceRecorderImpl.getCurrentStatus();
}
}
//# sourceMappingURL=VoiceRecorderWebAdapter.js.map