我在安卓上使用APPRTCdemo 应用程序。我试图让它播放来自另一个对等方的声音,就像在 Android 设置中设置的音量一样响亮。因此,如果用户将设备静音,则不会听到音频。我几乎尝试了所有 Android API 调用,但似乎对音量没有任何影响。这些是我尝试过的东西: AudioManager audioManager = (AudioManager)_context.getSystemService(Context.AUDIO_SERVICE); int 音量 = audioManager.getStreamVolume(AudioManager.STREAM_VOICE_CALL);
volume = audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
volume =audioManager.getStreamVolume(AudioManager.STREAM_RING);
volume =audioManager.getStreamVolume(AudioManager.STREAM_ALARM);
volume =audioManager.getStreamVolume(AudioManager.STREAM_NOTIFICATION);
volume =audioManager.getStreamVolume(AudioManager.STREAM_SYSTEM);
audioManager.setStreamVolume(AudioManager.STREAM_MUSIC, 0, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE);
audioManager.setStreamVolume(AudioManager.MODE_IN_COMMUNICATION, 0, AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE);
audioManager.setStreamVolume(AudioManager.STREAM_VOICE_CALL, 0,AudioManager.FLAG_REMOVE_SOUND_AND_VIBRATE);
audioManager.setStreamMute(AudioManager.MODE_IN_COMMUNICATION, true);
audioManager.setStreamMute(AudioManager.STREAM_SYSTEM, true);
audioManager.setStreamMute(AudioManager.STREAM_RING, true);
audioManager.setStreamMute(AudioManager.STREAM_MUSIC, true);
audioManager.setStreamMute(AudioManager.STREAM_NOTIFICATION, true);