cordova-plugin-opentok icon indicating copy to clipboard operation
cordova-plugin-opentok copied to clipboard

Changing Audio Output not possible on Android (Earpiece - Speaker)

Open jBoixBaro opened this issue 6 years ago • 8 comments

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,

jBoixBaro avatar Apr 08 '18 10:04 jBoixBaro

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

amatakasap avatar Apr 24 '18 00:04 amatakasap

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,

jBoixBaro avatar Apr 29 '18 20:04 jBoixBaro

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!

voxiel avatar Apr 24 '19 01:04 voxiel

I succeeded in calling the method by correcting the latest version.

terikon/cordova-plugin-photo-library#165

Bro, what are you talking about?

voxiel avatar Apr 24 '19 03:04 voxiel

I'm sorry. I was writing to a different issue.

amatakasap avatar Apr 25 '19 02:04 amatakasap

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.

amatakasap avatar Apr 25 '19 02:04 amatakasap

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!

voxiel avatar Apr 25 '19 04:04 voxiel

Hi @amatakasap is there a way to apply this feature also in this repo?

best regards

ColDrekken avatar Dec 20 '19 14:12 ColDrekken