Mountain View
Jabber SDK API Documentation

Tutorial: Conversation Video Control

Conversation Video Control

Title In this tutorial will be shown how to:
  • Mute video
  • Unmute video
  • Stop video
  • Start video
Mute/unmute video and Start/Stop video are similar features because they accomplish almost the same thing. Muting video will keep sending video frames but the remote participant will only see frozen frame (last frame before mute video has been done). Stopping video will stop video stream and remote participant wont receive any video frames.

Mute/Unmute Video

Muting video on TelephonyConversation will cause "onConversationUpdated" event to be fired. First it needs to be checked if conversation has canMuteVideo capability, and if it does, then call TelephonyConversation.muteVideo as it is shown in the snippet below:

        var conversation;

        // ...
        // Here we choose on which conversation we want to mute video.
        // ...

        if(conversation.capabilities.canMuteVideo)
        {
            // Mute video.
            conversation.muteVideo();
        }
    
Unmuting video on TelephonyConversation is done almost the same, after which "onConversationUpdated" event is fired. First it needs to be checked if conversation has canUnmuteVideo capability, and if it does, then call TelephonyConversation.unmuteVideo as it is shown in the snippet below:

        var conversation;

        // ...
        // Here we choose on which conversation we want to mute video.
        // ...

        if(conversation.capabilities.canUnmuteVideo)
        {
            // Unmute video.
            conversation.unmuteVideo();
        }
    

Start/Stop Video

Starting a video is somewhat different. We actually requires to check two capabilities, canStartVideo and canUpdateVideo, before calling TelephonyConversation.startVideo method. In the snippet bellow it is demonstrated how to achieve this:

        var conversation;

        // ...
        // Here we choose on which conversation we want to start video.
        // ...

        if(conversation.capabilities.canUpdateVideo && conversation.capabilities.canStartVideo)
        {
            // Start video.
            conversation.startVideo();
        }
    
Stopping a video is done in similar manner. Again two capabilities needs to be checked, canStopVideo and canUpdateVideo, before calling TelephonyConversation.stopVideo. In the snippet bellow it is demonstrated how to achieve this:

         var conversation;

         // ...
         // Here we choose on which conversation we want to stop video.
         // ...

         if(conversation.capabilities.canUpdateVideo && conversation.capabilities.canStopVideo)
         {
             // Stop video.
             conversation.stopVideo();
         }
     

Next

Previous