diff --git a/html5/verto/js/src/jquery.FSRTC.js b/html5/verto/js/src/jquery.FSRTC.js
index 1ed2a54e9b..d0bf7bf24c 100644
--- a/html5/verto/js/src/jquery.FSRTC.js
+++ b/html5/verto/js/src/jquery.FSRTC.js
@@ -1107,12 +1107,8 @@
video: video
},
onsuccess: function(e) {
- if(typeof e.stop == 'function') {
- e.stop();
- } else {
- e.active = false;
- }
- console.info(w + "x" + h + " supported."); $.FSRTC.validRes.push([w, h]); checkRes(cam, func);},
+ e.getTracks().forEach(function(track) {track.stop();});
+ console.info(w + "x" + h + " supported."); $.FSRTC.validRes.push([w, h]); checkRes(cam, func);},
onerror: function(e) {console.error( w + "x" + h + " not supported."); checkRes(cam, func);}
});
}
@@ -1148,15 +1144,12 @@
video: check_video,
},
onsuccess: function(e) {
- if(typeof e.stop == 'function') {
- e.stop();
- } else {
- e.active = false;
- }
- console.info("media perm init complete");
- if (runtime) {
- setTimeout(runtime, 100, true);
- }
+ e.getTracks().forEach(function(track) {track.stop();});
+
+ console.info("media perm init complete");
+ if (runtime) {
+ setTimeout(runtime, 100, true);
+ }
},
onerror: function(e) {
if (check_video && check_audio) {
diff --git a/html5/verto/video_demo/js/verto-min.js b/html5/verto/video_demo/js/verto-min.js
index eb58c9cb05..8d270b69dc 100644
--- a/html5/verto/video_demo/js/verto-min.js
+++ b/html5/verto/video_demo/js/verto-min.js
@@ -30,10 +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){if(typeof self.localStream.stop=='function'){self.localStream.stop();}else{self.localStream.active=false;}
+if(self.localStream){if(typeof self.localStream.stop=='function'){self.localStream.stop();}else{if(self.localStream.active){var tracks=self.localStream.getTracks();console.error(tracks);tracks.forEach(function(track,index){console.log(track);track.stop();})}}
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){if(typeof self.options.localVideoStream.stop=='function'){self.options.localVideoStream.stop();}else{self.options.localVideoStream.active=false;}}
+if(self.options.localVideoStream){if(typeof self.options.localVideoStream.stop=='function'){self.options.localVideoStream.stop();}else{if(self.localVideoStream.active){var tracks=self.localVideoStream.getTracks();console.error(tracks);tracks.forEach(function(track,index){console.log(track);track.stop();})}}}
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