lshannak / sipml5

Automatically exported from code.google.com/p/sipml5
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

Adds support for mute/unmute #67

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?

Please use labels and text to provide additional information.

Original issue reported on code.google.com by boss...@yahoo.fr on 12 Jan 2013 at 1:52

GoogleCodeExporter commented 9 years ago
Has this been added or it's on to-do list?
If already added, is there any documentation for the same?

Original comment by mehul.n....@gmail.com on 12 Mar 2013 at 8:54

GoogleCodeExporter commented 9 years ago
Bump... any movement on this?

Original comment by joshel...@gmail.com on 7 May 2013 at 3:51

GoogleCodeExporter commented 9 years ago
I created the following two functions that I use in my project for mute of 
camera and microphone.   Please feel free to use as well if its helpful.

////////////////////////////////////////////////////////////////////////////////
////////////////////
function muteMicrophone(bEnabled) {
    console.log("-->>>> muteMicrophone = " + bEnabled);
    if (oSipSessionCall != null) {
        // console.log("-->>>> muteMicrophone-> oSipSessionCall is valid");
        if (oSipSessionCall.o_session != null) {
          //  console.log("-->>>> muteMicrophone-> oSipSessionCall.o_session is valid");
            if (oSipSessionCall.o_session.o_stream_local != null) {
              //  console.log("-->>>> muteMicrophone-> oSipSessionCall.o_session.o_stream_local is valid");
                if (oSipSessionCall.o_session.o_stream_local.getAudioTracks().length > 0) {
                  //  console.log("-->>>> muteMicrophone-> oSipSessionCall.o_session.o_stream_local->Audio Tracks Greater than 0");
                    for (var nTrack = 0; nTrack < oSipSessionCall.o_session.o_stream_local.getAudioTracks().length ; nTrack++) {
                     // console.log("-->>>> muteMicrophone-> Setting Audio Tracks [" + nTrack + "] to state = " + bEnabled);
                        oSipSessionCall.o_session.o_stream_local.getAudioTracks()[nTrack].enabled = bEnabled;
                    }
                }
                else {
                    console.log("-->>>> muteMicrophone-> oSipSessionCall.o_session.o_stream_local-> NO AUDIO TRACKS");
                }
            }
            else {
                console.log("-->>>> muteMicrophone-> oSipSessionCall.o_session.o_stream_local is NULL");
            }
        }
        else {
            console.log("-->>>> muteMicrophone-> oSipSessionCall.o_session is NULL");
        }
    }
    else {
        console.log("-->>>> muteMicrophone-> oSipSessionCall  is NULL");
    }
}
////////////////////////////////////////////////////////////////////////////////
////////////////////
//
//

////////////////////////////////////////////////////////////////////////////////
////////////////////
function muteWebCam(bEnabled)
{
    console.log("-->>>> muteWebCam = " + bEnabled);
    if (oSipSessionCall != null) {
        // console.log("-->>>> muteWebCam-> oSipSessionCall is valid");
        if (oSipSessionCall.o_session != null) {
            // console.log("-->>>> muteWebCam-> oSipSessionCall.o_session is valid");
            if (oSipSessionCall.o_session.o_stream_local != null) {
               // console.log("-->>>> muteWebCam-> oSipSessionCall.o_session.o_stream_local is valid");
                if (oSipSessionCall.o_session.o_stream_local.getVideoTracks().length > 0) {
                 //   console.log("-->>>> muteWebCam-> oSipSessionCall.o_session.o_stream_local->Video Tracks Greater than 0");
                    for (var nTrack = 0; nTrack < oSipSessionCall.o_session.o_stream_local.getVideoTracks().length ; nTrack++) {
                   //     console.log("-->>>> muteWebCam-> Setting Video Tracks [" + nTrack + "] to state = " + bEnabled);
                        oSipSessionCall.o_session.o_stream_local.getVideoTracks()[nTrack].enabled = bEnabled;
                    }
                }
                else {
                    console.log("-->>>> muteWebCam-> oSipSessionCall.o_session.o_stream_local-> NO VIDEO TRACKS");
                }
            }
            else {
                console.log("-->>>> muteWebCam-> oSipSessionCall.o_session.o_stream_local is NULL");
            }
        }
        else {
            console.log("-->>>> muteWebCam-> oSipSessionCall.o_session is NULL");
        }
    }
    else {
        console.log("-->>>> muteWebCam-> oSipSessionCall  is NULL");
    }
}
////////////////////////////////////////////////////////////////////////////////
////////////////////

Original comment by sdellu...@gmail.com on 8 May 2013 at 5:53

GoogleCodeExporter commented 9 years ago
Check this out https://github.com/ISkomorokh/mediastream-gain-controller

Original comment by iskomor...@gmail.com on 29 Aug 2014 at 6:23