import { getRecorderManager, onRecordingEvent } from '@ray-js/ray'
const manager = await getRecorderManager();
let stopped = false;
onRecordingEvent(e => {
console.log(e);
// Stop after receiving the first recording data event; the event has fired and is self-cleaning.
if (!stopped) {
stopped = true;
manager.stopRecording({ success: () => {}, fail: () => {} });
}
});
// Start continuous recording to produce onRecordingEvent callbacks.
manager.startRecording({
period: 200,
pcm16IOS: true,
success: data => {
console.log(data);
},
fail: error => {
console.error(error);
},
});