cordova-plugin-opentok
cordova-plugin-opentok copied to clipboard
Changing Audio Output not possible on Android (Earpiece - Speaker)
Hi,
I am using opentok to voice only calls. Everything works as expected, but sound is playing on speaker.
I would like to switch from speaker to earpiece, but seems to be not possible.
I tried to use this plugins, but has not effect on opentok. (https://github.com/alongubkin/audiotoggle)
Is there any way to switch the sound output source?
Thanks,
You can switch speakers by calling the following before creating an instance of Session.
// voice calll AudioDeviceManager.getAudioDevice (). SetOutputMode (BaseAudioDevice.OutputMode.Handset);
// or video call AudioDeviceManager.getAudioDevice (). SetOutputMode (BaseAudioDevice.OutputMode.SpeakerPhone);
Please refer to this fork. https://github.com/amatakasap/cordova-plugin-opentok/tree/feature/voice-headset
Hi, how can I install the plugin of "feature/voice-headset" branch and not "3.2.0"?
I changed this: cordova plugin add cordova-plugin-opentok For this: cordova plugin add [email protected]:amatakasap/cordova-plugin-opentok.git#feature/voice-headset
But is not working.
Thanks,
Hello! I have this problem too. I'm using voice only calls and I really need this feature. @amatakasap link is not working now, I get 404. Is there any workaround for this? thank you!
I succeeded in calling the method by correcting the latest version.
Bro, what are you talking about?
I'm sorry. I was writing to a different issue.
The correct link is here. https://github.com/amatakasap/cordova-plugin-opentok
I use this fork along with cordova-plugin-audiotoggle to make audio-only calls.
Step 1. Specify Type
// callType is 'voice' or 'video'
const session = OT.initSession (apiKey, sessionId, callType)
Step 2. Switch the speaker
// voice call on Android
window.AudioToggle.setAudioMode (window.AudioToggle.RINGTONE)
// voice call on iOS
window.AudioToggle.setAudioMode (window.AudioToggle.EARPIECE)
Step 3. Replace the speakers (if necessary)
// Android
window.AudioToggle.setAudioMode (window.AudioToggle.NORMAL)
// iOS
window.AudioToggle.setAudioMode (window.AudioToggle.SPEAKER)
try it.
The correct link is here. https://github.com/amatakasap/cordova-plugin-opentok
I use this fork along with cordova-plugin-audiotoggle to make audio-only calls.
Step 1. Specify Type
// callType is 'voice' or 'video' const session = OT.initSession (apiKey, sessionId, callType)
Step 2. Switch the speaker
// voice call on Android window.AudioToggle.setAudioMode (window.AudioToggle.RINGTONE) // voice call on iOS window.AudioToggle.setAudioMode (window.AudioToggle.EARPIECE)
Step 3. Replace the speakers (if necessary)
// Android window.AudioToggle.setAudioMode (window.AudioToggle.NORMAL) // iOS window.AudioToggle.setAudioMode (window.AudioToggle.SPEAKER)
try it.
I'll give it a shot! Thank you!
Hi @amatakasap is there a way to apply this feature also in this repo?
best regards