From 90124856d4b40b3a2ef00bc4b6e843e67f4b75e7 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 25 Sep 2015 20:00:03 -0500 Subject: [PATCH] FS-8213 #resolve [Add support to skip permission checks on verto] --- html5/verto/js/src/jquery.FSRTC.js | 27 +++++++++++------- html5/verto/js/src/jquery.verto.js | 28 ++++++++++++------- .../src/vertoService/services/vertoService.js | 4 +-- html5/verto/video_demo/js/verto-min.js | 26 +++++++++-------- html5/verto/video_demo/verto.js | 4 ++- 5 files changed, 55 insertions(+), 34 deletions(-) diff --git a/html5/verto/js/src/jquery.FSRTC.js b/html5/verto/js/src/jquery.FSRTC.js index b06951e312..ddd376562d 100644 --- a/html5/verto/js/src/jquery.FSRTC.js +++ b/html5/verto/js/src/jquery.FSRTC.js @@ -453,7 +453,10 @@ var audio; - if (obj.options.videoParams && obj.options.screenShare) {//obj.options.videoParams.chromeMediaSource == 'desktop') { + if (obj.options.useMic && obj.options.useMic === "none") { + console.log("Microphone Disabled"); + audio = false; + } else if (obj.options.videoParams && obj.options.screenShare) {//obj.options.videoParams.chromeMediaSource == 'desktop') { //obj.options.videoParams = { // chromeMediaSource: 'screen', @@ -523,6 +526,7 @@ } } else { + console.log("Camera Disabled"); video = false; useVideo = false; } @@ -590,17 +594,20 @@ console.log("Audio constraints", mediaParams.audio); console.log("Video constraints", mediaParams.video); + if (mediaParams.audio || mediaParams.video) { - getUserMedia({ - constraints: { - audio: mediaParams.audio, + getUserMedia({ + constraints: { + audio: mediaParams.audio, video: mediaParams.video - }, - video: mediaParams.useVideo, - onsuccess: onSuccess, - onerror: onError - }); - + }, + video: mediaParams.useVideo, + onsuccess: onSuccess, + onerror: onError + }); + } else { + onSuccess(null); + } diff --git a/html5/verto/js/src/jquery.verto.js b/html5/verto/js/src/jquery.verto.js index 640cecca06..2dd8e71993 100644 --- a/html5/verto/js/src/jquery.verto.js +++ b/html5/verto/js/src/jquery.verto.js @@ -2601,17 +2601,25 @@ checkDevices(runtime); } - $.verto.init = function(obj, runtime, check) { - if(check == undefined) { - check = true; - } - $.FSRTC.checkPerms(function(status) { - if(check) { + $.verto.init = function(obj, runtime) { + if (!obj) { + obj = {}; + } + + if (!obj.skipPermCheck && !obj.skipDeviceCheck) { + $.FSRTC.checkPerms(function(status) { + checkDevices(runtime); + }, true, true); + } else if (obj.skipPermCheck && !obj.skipDeviceCheck) { checkDevices(runtime); - } else { - runtime(status); - } - }, true, true); + } else if (!obj.skipPermCheck && obj.skipDeviceCheck) { + $.FSRTC.checkPerms(function(status) { + runtime(status); + }, true, true); + } else { + runtime(null); + } + } $.verto.genUUID = function () { diff --git a/html5/verto/verto_communicator/src/vertoService/services/vertoService.js b/html5/verto/verto_communicator/src/vertoService/services/vertoService.js index 1437bb37ea..fc825973dc 100644 --- a/html5/verto/verto_communicator/src/vertoService/services/vertoService.js +++ b/html5/verto/verto_communicator/src/vertoService/services/vertoService.js @@ -576,12 +576,12 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora if(data.mediaPerm) { ourBootstrap(); } else { - $.verto.init({}, ourBootstrap, false); + $.verto.init({skipDeviceCheck: true}, ourBootstrap); } }, mediaPerm: function(callback) { - $.verto.init({}, callback, false); + $.FSRTC.checkPerms(callback, true, true); }, /** diff --git a/html5/verto/video_demo/js/verto-min.js b/html5/verto/video_demo/js/verto-min.js index 622cfa10a4..eb58c9cb05 100644 --- a/html5/verto/video_demo/js/verto-min.js +++ b/html5/verto/video_demo/js/verto-min.js @@ -30,9 +30,10 @@ self.options.useAudio.play();self.remoteStream=stream;} function onOfferSDP(self,sdp){self.mediaData.SDP=self.stereoHack(sdp.sdp);console.log("Offer SDP");doCallback(self,"onOfferSDP");} $.FSRTC.prototype.answer=function(sdp,onSuccess,onError){this.peer.addAnswerSDP({type:"answer",sdp:sdp},onSuccess,onError);};$.FSRTC.prototype.stopPeer=function(){if(self.peer){console.log("stopping peer");self.peer.stop();}} $.FSRTC.prototype.stop=function(){var self=this;if(self.options.useVideo){self.options.useVideo.style.display='none';if(moz){self.options.useVideo['mozSrcObject']=null;}else{self.options.useVideo['src']='';}} -if(self.localStream){self.localStream.stop();self.localStream=null;} +if(self.localStream){if(typeof self.localStream.stop=='function'){self.localStream.stop();}else{self.localStream.active=false;} +self.localStream=null;} if(self.options.localVideo){self.options.localVideo.style.display='none';if(moz){self.options.localVideo['mozSrcObject']=null;}else{self.options.localVideo['src']='';}} -if(self.options.localVideoStream){self.options.localVideoStream.stop();} +if(self.options.localVideoStream){if(typeof self.options.localVideoStream.stop=='function'){self.options.localVideoStream.stop();}else{self.options.localVideoStream.active=false;}} if(self.peer){console.log("stopping peer");self.peer.stop();}};$.FSRTC.prototype.getMute=function(){var self=this;return self.enabled;} $.FSRTC.prototype.setMute=function(what){var self=this;var audioTracks=self.localStream.getAudioTracks();for(var i=0,len=audioTracks.length;i