From 167c72ebc51ceba324f71d1cece4da02aee5c1b7 Mon Sep 17 00:00:00 2001 From: Jerry Hu <4749863+jerry2013@users.noreply.github.com> Date: Tue, 11 Apr 2023 16:24:50 -0400 Subject: [PATCH] add setDefaultAudioOutput to source #767 only contains changes to the compiled artifact and not the source - this is to add the same code so that `npm run build` won't lose the change. --- js/iosrtc.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/js/iosrtc.js b/js/iosrtc.js index 52b4d7fd..cf8334a6 100644 --- a/js/iosrtc.js +++ b/js/iosrtc.js @@ -51,10 +51,13 @@ module.exports = { // Select audio output (earpiece or speaker). selectAudioOutput: selectAudioOutput, + // Set default audio output (earpiece or speaker). + setDefaultAudioOutput: setDefaultAudioOutput, + // turnOnSpeaker with options turnOnSpeaker: turnOnSpeaker, - // Checking permision (audio and camera) + // Checking permission (audio and camera) requestPermission: requestPermission, // Expose a function to initAudioDevices if needed, sets the audio session active @@ -101,6 +104,14 @@ function selectAudioOutput(output) { } } +function setDefaultAudioOutput(output) { + debug('setDefaultAudioOutput() | [output:"%s"]', output); + if (!['earpiece', 'speaker'].includes(output)) { + throw new Error('output must be "earpiece" or "speaker"'); + } + exec(null, null, 'iosrtcPlugin', 'setDefaultAudioOutput', [output === 'speaker']); +} + function turnOnSpeaker(isTurnOn) { debug('turnOnSpeaker() | [isTurnOn:"%s"]', isTurnOn);