diff --git a/html5/verto/js/src/jquery.FSRTC.js b/html5/verto/js/src/jquery.FSRTC.js index d0bf7bf24c..7d3e0ad2ec 100644 --- a/html5/verto/js/src/jquery.FSRTC.js +++ b/html5/verto/js/src/jquery.FSRTC.js @@ -90,7 +90,8 @@ }, }, options); - this.enabled = true; + this.audioEnabled = true; + this.videoEnabled = true; this.mediaData = { @@ -360,7 +361,7 @@ $.FSRTC.prototype.getMute = function() { var self = this; - return self.enabled; + return self.audioEnabled; } $.FSRTC.prototype.setMute = function(what) { @@ -381,10 +382,39 @@ break; } - self.enabled = audioTracks[i].enabled; + self.audioEnabled = audioTracks[i].enabled; } - return !self.enabled; + return !self.audioEnabled; + } + + $.FSRTC.prototype.getVideoMute = function() { + var self = this; + return self.videoEnabled; + } + + $.FSRTC.prototype.setVideoMute = function(what) { + var self = this; + var videoTracks = self.localStream.getVideoTracks(); + + for (var i = 0, len = videoTracks.length; i < len; i++ ) { + switch(what) { + case "on": + videoTracks[i].enabled = true; + break; + case "off": + videoTracks[i].enabled = false; + break; + case "toggle": + videoTracks[i].enabled = !videoTracks[i].enabled; + default: + break; + } + + self.videoEnabled = videoTracks[i].enabled; + } + + return !self.videoEnabled; } $.FSRTC.prototype.createAnswer = function(params) { diff --git a/html5/verto/js/src/jquery.verto.js b/html5/verto/js/src/jquery.verto.js index 779ba79125..b7912c2a72 100644 --- a/html5/verto/js/src/jquery.verto.js +++ b/html5/verto/js/src/jquery.verto.js @@ -2226,6 +2226,16 @@ return dialog.rtc.getMute(); }; + $.verto.dialog.prototype.setVideoMute = function(what) { + var dialog = this; + return dialog.rtc.setVideoMute(what); + }; + + $.verto.dialog.prototype.getVideoMute = function() { + var dialog = this; + return dialog.rtc.getVideoMute(); + }; + $.verto.dialog.prototype.useStereo = function(on) { var dialog = this; diff --git a/html5/verto/verto_communicator/src/vertoControllers/controllers/ChatController.js b/html5/verto/verto_communicator/src/vertoControllers/controllers/ChatController.js index 256d1bb3e5..3129db87c7 100644 --- a/html5/verto/verto_communicator/src/vertoControllers/controllers/ChatController.js +++ b/html5/verto/verto_communicator/src/vertoControllers/controllers/ChatController.js @@ -120,6 +120,8 @@ if (parseInt(member.id) == parseInt(verto.data.conferenceMemberID)) { verto.data.mutedMic = member.status.audio.muted; verto.data.mutedVideo = member.status.video.muted; + verto.data.call.setMute(member.status.audio.muted ? "off" : "on"); + verto.data.call.setVideoMute(member.status.video.muted ? "off" : "on"); } angular.extend($scope.members[memberIdx], member); }); diff --git a/html5/verto/video_demo/index.html b/html5/verto/video_demo/index.html index 276b75b36b..74992e5807 100644 --- a/html5/verto/video_demo/index.html +++ b/html5/verto/video_demo/index.html @@ -147,6 +147,7 @@ div#preload { display: none; } + diff --git a/html5/verto/video_demo/js/verto-min.js b/html5/verto/video_demo/js/verto-min.js index fd9430ce4e..71e5e27b08 100644 --- a/html5/verto/video_demo/js/verto-min.js +++ b/html5/verto/video_demo/js/verto-min.js @@ -6,7 +6,7 @@ function getCodecPayloadType(sdpLine){var pattern=new RegExp('a=rtpmap:(\\d+) \\ function setDefaultCodec(mLine,payload){var elements=mLine.split(' ');var newLine=[];var index=0;for(var i=0;i=$.verto.enum.state.new.val&&dialog.state.val<$.verto.enum.state.hangup.val){dialog.setState($.verto.enum.state.hangup);}else if(dialog.state.val<$.verto.enum.state.destroy){dialog.setState($.verto.enum.state.destroy);}};$.verto.dialog.prototype.stopRinging=function(){var dialog=this;if(dialog.verto.ringer){dialog.verto.ringer.stop();}};$.verto.dialog.prototype.indicateRing=function(){var dialog=this;if(dialog.verto.ringer){dialog.verto.ringer.attr("src",dialog.verto.options.ringFile)[0].play();setTimeout(function(){dialog.stopRinging();if(dialog.state==$.verto.enum.state.ringing){dialog.indicateRing();}},dialog.verto.options.ringSleep);}};$.verto.dialog.prototype.ring=function(){var dialog=this;dialog.setState($.verto.enum.state.ringing);dialog.indicateRing();};$.verto.dialog.prototype.useVideo=function(on){var dialog=this;dialog.params.useVideo=on;if(on){dialog.videoStream=dialog.audioStream;}else{dialog.videoStream=null;} -dialog.rtc.useVideo(dialog.videoStream,dialog.localVideo);};$.verto.dialog.prototype.setMute=function(what){var dialog=this;return dialog.rtc.setMute(what);};$.verto.dialog.prototype.getMute=function(){var dialog=this;return dialog.rtc.getMute();};$.verto.dialog.prototype.useStereo=function(on){var dialog=this;dialog.params.useStereo=on;dialog.rtc.useStereo(on);};$.verto.dialog.prototype.dtmf=function(digits){var dialog=this;if(digits){dialog.sendMethod("verto.info",{dtmf:digits});}};$.verto.dialog.prototype.transfer=function(dest,params){var dialog=this;if(dest){dialog.sendMethod("verto.modify",{action:"transfer",destination:dest,params:params});}};$.verto.dialog.prototype.hold=function(params){var dialog=this;dialog.sendMethod("verto.modify",{action:"hold",params:params});};$.verto.dialog.prototype.unhold=function(params){var dialog=this;dialog.sendMethod("verto.modify",{action:"unhold",params:params});};$.verto.dialog.prototype.toggleHold=function(params){var dialog=this;dialog.sendMethod("verto.modify",{action:"toggleHold",params:params});};$.verto.dialog.prototype.message=function(msg){var dialog=this;var err=0;msg.from=dialog.params.login;if(!msg.to){console.error("Missing To");err++;} +dialog.rtc.useVideo(dialog.videoStream,dialog.localVideo);};$.verto.dialog.prototype.setMute=function(what){var dialog=this;return dialog.rtc.setMute(what);};$.verto.dialog.prototype.getMute=function(){var dialog=this;return dialog.rtc.getMute();};$.verto.dialog.prototype.setVideoMute=function(what){var dialog=this;return dialog.rtc.setVideoMute(what);};$.verto.dialog.prototype.getVideoMute=function(){var dialog=this;return dialog.rtc.getVideoMute();};$.verto.dialog.prototype.useStereo=function(on){var dialog=this;dialog.params.useStereo=on;dialog.rtc.useStereo(on);};$.verto.dialog.prototype.dtmf=function(digits){var dialog=this;if(digits){dialog.sendMethod("verto.info",{dtmf:digits});}};$.verto.dialog.prototype.transfer=function(dest,params){var dialog=this;if(dest){dialog.sendMethod("verto.modify",{action:"transfer",destination:dest,params:params});}};$.verto.dialog.prototype.hold=function(params){var dialog=this;dialog.sendMethod("verto.modify",{action:"hold",params:params});};$.verto.dialog.prototype.unhold=function(params){var dialog=this;dialog.sendMethod("verto.modify",{action:"unhold",params:params});};$.verto.dialog.prototype.toggleHold=function(params){var dialog=this;dialog.sendMethod("verto.modify",{action:"toggleHold",params:params});};$.verto.dialog.prototype.message=function(msg){var dialog=this;var err=0;msg.from=dialog.params.login;if(!msg.to){console.error("Missing To");err++;} if(!msg.body){console.error("Missing Body");err++;} if(err){return false;} dialog.sendMethod("verto.info",{msg:msg});return true;};$.verto.dialog.prototype.answer=function(params){var dialog=this;if(!dialog.answered){if(!params){params={};} diff --git a/html5/verto/video_demo/verto.js b/html5/verto/video_demo/verto.js index 32caac3041..31bb147da3 100644 --- a/html5/verto/video_demo/verto.js +++ b/html5/verto/video_demo/verto.js @@ -716,6 +716,17 @@ $("#localmutebtn").click(function() { }); +$("#localvidmutebtn").click(function() { + var muted = cur_call.setVideoMute("toggle"); + + if (muted) { + display("Talking to: " + cur_call.cidString() + " [VIDEO LOCALLY MUTED]"); + } else { + display("Talking to: " + cur_call.cidString()); + } + +}); + $("#vmutebtn").click(function() { cur_call.dtmf("*0"); }); diff --git a/src/mod/applications/mod_conference/conference_video.c b/src/mod/applications/mod_conference/conference_video.c index 1dabed8888..62120322e8 100644 --- a/src/mod/applications/mod_conference/conference_video.c +++ b/src/mod/applications/mod_conference/conference_video.c @@ -1845,7 +1845,7 @@ void conference_video_pop_next_image(conference_member_t *member, switch_image_t void conference_video_set_incoming_bitrate(conference_member_t *member, int kps) { switch_core_session_message_t msg = { 0 }; - + msg.message_id = SWITCH_MESSAGE_INDICATE_BITRATE_REQ; msg.numeric_arg = kps * 1024; msg.from = __FILE__; @@ -1902,7 +1902,7 @@ void conference_video_check_auto_bitrate(conference_member_t *member, mcu_layer_ if (switch_channel_test_flag(member->channel, CF_VIDEO_BITRATE_UNMANAGABLE)) { member->managed_kps = 0; } else if (conference_utils_test_flag(member->conference, CFLAG_MANAGE_INBOUND_VIDEO_BITRATE) && !member->managed_kps) { - int kps; + int kps = 256; int w = 320; int h = 240; @@ -1922,11 +1922,7 @@ void conference_video_check_auto_bitrate(conference_member_t *member, mcu_layer_ } else { int max = 0; - if (!layer || !conference_utils_member_test_flag(member, MFLAG_CAN_BE_SEEN) || member->avatar_png_img) { - kps = 256; - switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "%s auto-setting bitrate to %dkps because user's image is not visible\n", - switch_channel_get_name(member->channel), kps); - } else { + if (layer) { kps = switch_calc_bitrate(w, h, 1, (int)(member->conference->video_fps.fps)); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG1, "%s auto-setting bitrate to %dkps to accomodate %dx%d resolution\n", switch_channel_get_name(member->channel), kps, layer->screen_w, layer->screen_h); @@ -1944,7 +1940,6 @@ void conference_video_check_auto_bitrate(conference_member_t *member, mcu_layer_ switch_channel_get_name(member->channel), kps); } } - conference_video_set_incoming_bitrate(member, kps); } } diff --git a/src/switch_core_media.c b/src/switch_core_media.c index 904da2e9e9..dbec5b0d95 100644 --- a/src/switch_core_media.c +++ b/src/switch_core_media.c @@ -10894,12 +10894,6 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core return SWITCH_STATUS_FALSE; } - if (switch_channel_test_flag(session->channel, CF_VIDEO_PAUSE_READ)) { - *frame = &runtime.dummy_cng_frame; - switch_yield(20000); - return SWITCH_STATUS_SUCCESS; - } - if (session->endpoint_interface->io_routines->read_video_frame) { if ((status = session->endpoint_interface->io_routines->read_video_frame(session, frame, flags, stream_id)) == SWITCH_STATUS_SUCCESS) { for (ptr = session->event_hooks.video_read_frame; ptr; ptr = ptr->next) { @@ -10910,6 +10904,12 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_read_video_frame(switch_core } } + if (switch_channel_test_flag(session->channel, CF_VIDEO_PAUSE_READ)) { + *frame = &runtime.dummy_cng_frame; + switch_cond_next(); + return SWITCH_STATUS_SUCCESS; + } + if (status == SWITCH_STATUS_INUSE) { *frame = &runtime.dummy_cng_frame; switch_cond_next();