Android WebRTC实施-体积非常小 [英] Android WebRTC implementaion - very low volume
问题描述
我已使用以下示例在我的应用程序中实现了视频会议的选项: https://github.com/androidthings/sample-videoRTC
I have implement an option of Video Conference on my application using the following example: https://github.com/androidthings/sample-videoRTC
基本上工作得很好,但是我有一个主要问题.即使我将最大音量放在设备上,声音的音量也非常低.
basically is is working very well but i have one major issue. the sreaming audio volume is very very low even when i put the maximum volume on my device.
我尝试检查是否有任何参数可以定义音频音量,但是在AudioBitRate(= 32)和AudioCodec =("OPUS")旁边找不到此类参数.
I have tried to check if there is any parameter that can define the audio volume but is was not able to find such parameters beside the AudioBitRate(=32) and the AudioCodec=("OPUS").
以下是用于创建peerConnection的参数:
These are the parameters that is am using for creating the peerConnection:
peerConnectionParameters =
new PeerConnectionClient.PeerConnectionParameters(true,
false,
false,
videoWidth,
videoHeight,
0,
Integer.parseInt(getString(R.string.pref_maxvideobitratevalue_default)),
getString(R.string.pref_videocodec_default),
true,
false,
Integer.parseInt(getString(R.string.pref_startaudiobitratevalue_default)),
getString(R.string.pref_audiocodec_default),
false,
false,
false,
false,
false,
false,
false,
false,
null);
有人知道如何提高音量吗?
Is anyone have some idea how can I improve the audio volume?
我尝试替换默认的音频编解码器,但结果是相同的低音量.
Ihave tried to replace the default Audio Codec but the result was the same low vloume.
推荐答案
经过多次检查和调查,我发现了问题所在.如果有人会遇到同样的问题,我会在这里回答.
After many check and investigation i have found the problem. i am answering it here if someone else will have the same problem.
我注意到声音不是传递给扬声器,而是传递给耳塞...所以我添加了下面的代码来打开扬声器,问题已经解决了!
i have notice that the voice is not routed to the speaker but to the ear cap...so i add the bellow code to turn on the speaker and the problem has solved !
audioManager = (AudioManager) this.activity.getSystemService(Context.AUDIO_SERVICE);
audioManager.setSpeakerphoneOn(true);
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
要回答我将代码放在哪里的问题,实际上我已经添加了一个新图标,以使用户可以在耳机和扬声器之间切换.
To answer the question where i put the code, i have actually add a new icon to give the user to switch between headset and speaker.
这是完整的代码:
toggleSpeakerHeadset.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (speakerOn) {
setHeadsetOn();
} else {
setSpeakerOn();
}
}
});
private void setSpeakerOn() {
speakerOn = true;
toggleSpeakerHeadset.setImageResource(R.drawable.headset);
audioManager.setSpeakerphoneOn(true);
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
}
private void setHeadsetOn() {
speakerOn = false;
toggleSpeakerHeadset.setImageResource(R.drawable.speaker);
audioManager.setSpeakerphoneOn(false);
audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
}
这篇关于Android WebRTC实施-体积非常小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!