sipML5 - Mute / Pause local audio and video streams

2,087 views
Skip to first unread message

Steve

unread,
Apr 20, 2013, 6:05:30 PM4/20/13
to discuss-doubango
Hi
Can anyone point me to how to instrument the equivalent of a mute of
the microphone and and stop of the web cam while in call?

With the webcam, I attempted to .pause on the local video element but
that only paused the local display of the webcam...and the images are
still transmitted to the remote party.

Thanks in advance.

Steve

unread,
May 1, 2013, 12:35:37 AM5/1/13
to discuss-doubango
bump.

I am hoping someone can point me to how to do this.
Thanks in advance for your help
SD

AutoStatic

unread,
May 1, 2013, 5:03:36 AM5/1/13
to doub...@googlegroups.com
On Wednesday, 1 May 2013 06:35:37 UTC+2, Steve wrote:
bump.

I am hoping someone can point me to how to do this.
Thanks in advance for your help
SD

Hi Steve,

We need to implement this too in the near future so I'll keep you posted on any upcoming developments.

Regards,

Jeremy

Steve

unread,
May 1, 2013, 10:34:49 AM5/1/13
to discuss-doubango
Thanks Jeremy! (and thanks again for all your support... you have been
incredibly helpful to me :) )

Is there any way that I can help to move this issue forward? Are
there some javascript APIs that I could write to and contribute back
to the project?

I am attempting to put the system into a test user group application
for my org, but they will for sure not move forward without having the
ability to mute (audio and video).

Thanks again!
SD

Mamadou DIOP

unread,
May 1, 2013, 3:37:38 PM5/1/13
to doub...@googlegroups.com
set (audio/video)Tracks[n].enabled = true/false; to mute/unmute
> --
> You received this message because you are subscribed to the Google Groups "discuss-doubango" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to doubango+u...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
>
>

Mamadou DIOP

unread,
May 1, 2013, 3:40:21 PM5/1/13
to doub...@googlegroups.com

Steve

unread,
May 8, 2013, 1:56:00 AM5/8/13
to doub...@googlegroups.com
Thanks for the pointers.... I have updated the incident with my findings.... 
For the benefit of the other members of the forum... I have created the following two JavaScript functions that work well for me.   See below...

////////////////////////////////////////////////////////////////////////////////////////////////////
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");
    }
}
////////////////////////////////////////////////////////////////////////////////////////////////////

Steve

unread,
May 9, 2013, 1:16:30 AM5/9/13
to doub...@googlegroups.com
BTW... I have done some additional testing, and found that while this does indeed work on latest chrome version on WIndows, and on Nexus 7 Android tablet, and Samsung Galaxy S3 Mobile phone;  it DOES NOT WORK on Ubuntu Desktop with latest Chromium release... seems that the API for getAudioTracks and getVideoTracks has not yet made it into that browser version..... just an FYI.....
Thanks.

Steve

unread,
May 9, 2013, 1:26:57 AM5/9/13
to doub...@googlegroups.com
However, if you manually go to Google website and download the DEB file for "CHROME" and install that... then this API is present and the code below works.   Chromium is the variant of Chrome that is in the standard Ubuntu repos, so I mistakenly thought I had chrome when I did not....

Shawn Christopher

unread,
Apr 18, 2014, 2:10:43 PM4/18/14
to doub...@googlegroups.com
Is there an update on this? 

Trying to mute the audio using normal JS just isn't working...

Thanks,
Shawn

Igor Skomorokh

unread,
Aug 29, 2014, 2:23:11 AM8/29/14
to doub...@googlegroups.com
I have written a bit better solution for muting/unmuting here https://github.com/ISkomorokh/mediastream-gain-controller

пятница, 18 апреля 2014 г., 21:10:43 UTC+3 пользователь Shawn Christopher написал:
Reply all
Reply to author
Forward
0 new messages