diff --git a/html5/verto/js/src/jquery.FSRTC.js b/html5/verto/js/src/jquery.FSRTC.js
index 6baf7aa54c..ad60eb0f39 100644
--- a/html5/verto/js/src/jquery.FSRTC.js
+++ b/html5/verto/js/src/jquery.FSRTC.js
@@ -289,7 +289,7 @@
if (self.options.useVideo) {
self.options.useVideo.style.display = 'none';
- self.options.useVideo[moz ? 'mozSrcObject' : 'src'] = "";
+ self.options.useVideo[moz ? 'mozSrcObject' : 'src'] = null;
}
if (self.localStream) {
@@ -299,7 +299,7 @@
if (self.options.localVideo) {
self.options.localVideo.style.display = 'none';
- self.options.localVideo[moz ? 'mozSrcObject' : 'src'] = "";
+ self.options.localVideo[moz ? 'mozSrcObject' : 'src'] = null;
}
if (self.options.localVideoStream) {
diff --git a/html5/verto/js/src/jquery.verto.js b/html5/verto/js/src/jquery.verto.js
index 149efb6309..4361c0791f 100644
--- a/html5/verto/js/src/jquery.verto.js
+++ b/html5/verto/js/src/jquery.verto.js
@@ -2150,24 +2150,64 @@
$.FSRTC.getValidRes(obj.camera, function() {
console.info("enumerating devices");
+
+ if (MediaStreamTrack.getSources) {
+ MediaStreamTrack.getSources(function (media_sources) {
+ for (var i = 0; i < media_sources.length; i++) {
- MediaStreamTrack.getSources(function (media_sources) {
- for (var i = 0; i < media_sources.length; i++) {
-
- if (media_sources[i].kind == 'video') {
- vid.push(media_sources[i]);
- } else {
- aud.push(media_sources[i]);
+ if (media_sources[i].kind == 'video') {
+ vid.push(media_sources[i]);
+ } else {
+ aud.push(media_sources[i]);
+ }
}
+
+ $.verto.videoDevices = vid;
+ $.verto.audioDevices = aud;
+
+ console.info("Audio Devices", $.verto.audioDevices);
+ console.info("Video Devices", $.verto.videoDevices);
+ runtime();
+ });
+ } else {
+ /* of course it's a totally different API CALL with different element names for the same exact thing */
+
+ if (!navigator.mediaDevices || !navigator.mediaDevices.enumerateDevices) {
+ console.log("enumerateDevices() not supported.");
+ return;
}
-
- $.verto.videoDevices = vid;
- $.verto.audioDevices = aud;
-
- console.info("Audio Devices", $.verto.audioDevices);
- console.info("Video Devices", $.verto.videoDevices);
- runtime();
- });
+
+ // List cameras and microphones.
+
+ navigator.mediaDevices.enumerateDevices()
+ .then(function(devices) {
+ devices.forEach(function(device) {
+ console.log(device);
+
+ console.log(device.kind + ": " + device.label +
+ " id = " + device.deviceId);
+
+ if (device.kind === "videoinput") {
+ vid.push({id: device.deviceId, kind: "video", label: device.label});
+ } else {
+ aud.push({id: device.deviceId, kind: "audio", label: device.label});
+ }
+ });
+
+
+ $.verto.videoDevices = vid;
+ $.verto.audioDevices = aud;
+
+ console.info("Audio Devices", $.verto.audioDevices);
+ console.info("Video Devices", $.verto.videoDevices);
+ runtime();
+
+ })
+ .catch(function(err) {
+ console.log(err.name + ": " + error.message);
+ runtime();
+ });
+ }
});
}
diff --git a/html5/verto/video_demo/js/verto-min.js b/html5/verto/video_demo/js/verto-min.js
index 109a9b3282..32b49f0abf 100644
--- a/html5/verto/video_demo/js/verto-min.js
+++ b/html5/verto/video_demo/js/verto-min.js
@@ -27,9 +27,9 @@ function onRemoteStream(self,stream){if(self.options.useVideo){self.options.useV
var element=self.options.useAudio;console.log("REMOTE STREAM",stream,element);if(typeof element.srcObject!=='undefined'){element.srcObject=stream;}else if(typeof element.mozSrcObject!=='undefined'){element.mozSrcObject=stream;}else if(typeof element.src!=='undefined'){element.src=URL.createObjectURL(stream);}else{console.error('Error attaching stream to element.');}
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.stop=function(){var self=this;if(self.options.useVideo){self.options.useVideo.style.display='none';self.options.useVideo[moz?'mozSrcObject':'src']="";}
+$.FSRTC.prototype.answer=function(sdp,onSuccess,onError){this.peer.addAnswerSDP({type:"answer",sdp:sdp},onSuccess,onError);};$.FSRTC.prototype.stop=function(){var self=this;if(self.options.useVideo){self.options.useVideo.style.display='none';self.options.useVideo[moz?'mozSrcObject':'src']=null;}
if(self.localStream){self.localStream.stop();self.localStream=null;}
-if(self.options.localVideo){self.options.localVideo.style.display='none';self.options.localVideo[moz?'mozSrcObject':'src']="";}
+if(self.options.localVideo){self.options.localVideo.style.display='none';self.options.localVideo[moz?'mozSrcObject':'src']=null;}
if(self.options.localVideoStream){self.options.localVideoStream.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=$.verto.enum.state.early.val){dialog.setState($.verto.enum.
if(params.display_number){dialog.params.remote_caller_id_number=params.display_number;}
dialog.sendMessage($.verto.enum.message.display,{});};$.verto.dialog.prototype.handleMedia=function(params){var dialog=this;if(dialog.state.val>=$.verto.enum.state.early.val){return;}
dialog.gotEarly=true;dialog.rtc.answer(params.sdp,function(){console.log("Dialog "+dialog.callID+"Establishing early media");dialog.setState($.verto.enum.state.early);if(dialog.gotAnswer){console.log("Dialog "+dialog.callID+"Answering Channel");dialog.setState($.verto.enum.state.active);}},function(e){console.error(e);dialog.hangup();});console.log("Dialog "+dialog.callID+"EARLY SDP",params.sdp);};$.verto.ENUM=function(s){var i=0,o={};s.split(" ").map(function(x){o[x]={name:x,val:i++};});return Object.freeze(o);};$.verto.enum={};$.verto.enum.states=Object.freeze({new:{requesting:1,recovering:1,ringing:1,destroy:1,answering:1,hangup:1},requesting:{trying:1,hangup:1},recovering:{answering:1,hangup:1},trying:{active:1,early:1,hangup:1},ringing:{answering:1,hangup:1},answering:{active:1,hangup:1},active:{answering:1,requesting:1,hangup:1,held:1},held:{hangup:1,active:1},early:{hangup:1,active:1},hangup:{destroy:1},destroy:{},purge:{destroy:1}});$.verto.enum.state=$.verto.ENUM("new requesting trying recovering ringing answering early active held hangup destroy purge");$.verto.enum.direction=$.verto.ENUM("inbound outbound");$.verto.enum.message=$.verto.ENUM("display info pvtEvent");$.verto.enum=Object.freeze($.verto.enum);$.verto.saved=[];$(window).bind('beforeunload',function(){for(var i in $.verto.saved){var verto=$.verto.saved[i];if(verto){verto.purge();verto.logout();}}
-return $.verto.warnOnUnload;});$.verto.videoDevices=[];$.verto.audioDevices=[];$.verto.init=function(obj,runtime){var aud=[],vid=[];$.FSRTC.getValidRes(obj.camera,function(){console.info("enumerating devices");MediaStreamTrack.getSources(function(media_sources){for(var i=0;i