Skip to content

WebRTC playback volume control

Android SDK uses libjingle_peerconnection library to implement WebRTC. In thie library, incall volume changing is hardcoded to control playback volume

code

private int SetPlayoutVolume(int level) {

    // create audio manager if needed
    if (_audioManager == null && _context != null) {
        _audioManager = (AudioManager)
            _context.getSystemService(Context.AUDIO_SERVICE);
    }

    int retVal = -1;

    if (_audioManager != null) {
        _audioManager.setStreamVolume(AudioManager.STREAM_VOICE_CALL,
                        level, 0);
        retVal = 0;
    }

    return retVal;
}

Therefore, incall volume only can be changed when playback volume is set in any Android SDK based application. However, it is possible to switch from hands free to device speakerphone and vice versa (see Media Devices example)