libstreaming icon indicating copy to clipboard operation
libstreaming copied to clipboard

mute microphone in streaming

Open nocturnalprelude opened this issue 10 years ago • 6 comments

I need to disable audio microphone source with a button, and I've found in Session class:

/** You probably don't need to use that directly, use the {@link SessionBuilder}. */
void removeAudioTrack() {
    if (mAudioStream != null) {
        mAudioStream.stop();
        mAudioStream = null;
    }
}

I didn't find in SessionBuilder the method calling this removeAudioTrack()... Should I implement it by myself or there's another way to do the trick ?

nocturnalprelude avatar Nov 11 '14 15:11 nocturnalprelude

+1 the following solution is finicky at best: AudioManager myAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);

kmlx avatar Nov 27 '14 12:11 kmlx

@kmlx that didn't work for me. I can still hear the sound. AudioManager myAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); myAudioManager.setMicrophoneMute(true);

serpro avatar Mar 16 '15 16:03 serpro

depends on the device. on nexus7 2013 works perfectly. same for others. but mostly samsung devices don't work.

kmlx avatar Mar 16 '15 20:03 kmlx

I'm using:

mSession = SessionBuilder.getInstance() .setContext(getApplicationContext()) .setAudioEncoder(SessionBuilder.AUDIO_NONE) .setAudioQuality(new AudioQuality(8000,16000)) .setVideoEncoder(SessionBuilder.VIDEO_H264) .setSurfaceView(mSurfaceView) .setPreviewOrientation(0) .setCallback(this) .build();

after the session is stopped, so I can mute the audio in this way and restart the session...

nocturnalprelude avatar Mar 17 '15 08:03 nocturnalprelude

and that should work, but the problem relies with muting the sound while in streaming. For example:

AudioManager myAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
myAudioManager.setMicrophoneMute(true);

this doesn't work on all devices/android versions. But it does work on some of them.

kmlx avatar Mar 17 '15 09:03 kmlx

@nocturnalprelude Hello i am getting the audio issue will u plz help me how to fix it plzzz plzz

Programmerpk avatar Oct 29 '18 09:10 Programmerpk