OpenVidu发布者从耳机扬声器输出声音

huangapple go评论65阅读模式
英文:

OpenVidu Publisher Sound from Ear Speaker

问题

我在我的应用中使用openvidu。当我订阅发布者的视频时,发布者的声音会从耳机输出(就像在通话期间一样)。我如何将输出源设置为扬声器?

英文:

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?

答案1

得分: 0

以下是翻译好的部分:

这可以通过在 Ionic 4+ 中执行以下操作来实现。

1. 您需要使用以下插件

https://github.com/neohelden/cordova-plugin-audiotoggle

cordova plugin add https://github.com/neohelden/cordova-plugin-audiotoggle

2. 在您希望启用耳机或扬声器的 component.ts 中

declare var AudioToggle: any;

// 启用耳机的方法

enableEarpiece(){
     if(this.platform.is('cordova')){
          AudioToggle.setAudioMode(AudioToggle.EARPIECE);
     }
}
    
// 启用扬声器的方法

enableSpeaker(){
     if(this.platform.is('cordova')){
          AudioToggle.setAudioMode(AudioToggle.SPEAKER);
     }
}
英文:

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);
     }
}

huangapple
  • 本文由 发表于 2020年1月6日 23:23:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/59614670.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定