Issue
I use openvidu in my app. When I subscribe to a publisher video, publisher's sound comes out from the earpiece (like during a call). How can I set output source to speaker?
Solution
This can be achieved by doing the following in Ionic 4+.
1. You need to use the following plugin
https://github.com/neohelden/cordova-plugin-audiotoggle
cordova plugin add https://github.com/neohelden/cordova-plugin-audiotoggle
2. In your component.ts where you want to enable the ear-piece or speaker
declare var AudioToggle: any;
//Method To Enable Earpiece
enableEarpiece(){
if(this.platform.is('cordova')){
AudioToggle.setAudioMode(AudioToggle.EARPIECE);
}
}
// Method To Enable the Speakers
enableSpeaker(){
if(this.platform.is('cordova')){
AudioToggle.setAudioMode(AudioToggle.SPEAKER);
}
}
Answered By - Subhojit Dutta
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.