Skip to content

Commit

Permalink
add setDefaultAudioOutput to source
Browse files Browse the repository at this point in the history
#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.
  • Loading branch information
jerry2013 authored Apr 11, 2023
1 parent a1bef4f commit 167c72e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion js/iosrtc.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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);

Expand Down

0 comments on commit 167c72e

Please sign in to comment.