diff --git a/html5/verto/video_demo/index.html b/html5/verto/video_demo/index.html
index cece37d0b1..03bbf469e4 100644
--- a/html5/verto/video_demo/index.html
+++ b/html5/verto/video_demo/index.html
@@ -278,6 +278,9 @@ if ($('#devices').is(':visible')) {
+
+
+
diff --git a/html5/verto/video_demo/js/verto-min.js b/html5/verto/video_demo/js/verto-min.js
index 29dadb4cf8..aead8f2e7d 100644
--- a/html5/verto/video_demo/js/verto-min.js
+++ b/html5/verto/video_demo/js/verto-min.js
@@ -34,12 +34,12 @@ if(self.options.localVideoStream){self.options.localVideoStream.stop();}
if(self.peer){console.log("stopping peer");self.peer.stop();}};$.FSRTC.prototype.createAnswer=function(params){var self=this;self.type="answer";self.remoteSDP=params.sdp;console.debug("inbound sdp: ",params.sdp);self.options.useCamera=params.useCamera||"any";self.options.useMic=params.useMic||"any";function onSuccess(stream){self.localStream=stream;self.peer=RTCPeerConnection({type:self.type,attachStream:self.localStream,onICE:function(candidate){return onICE(self,candidate);},onICEComplete:function(){return onICEComplete(self);},onRemoteStream:function(stream){return onRemoteStream(self,stream);},onICESDP:function(sdp){return onICESDP(self,sdp);},onChannelError:function(e){return onChannelError(self,e);},constraints:self.constraints,iceServers:self.options.iceServers,offerSDP:{type:"offer",sdp:self.remoteSDP}});onStreamSuccess(self);}
function onError(e){onStreamError(self,e);}
var mediaParams=getMediaParams(self);console.log("Audio constraints",mediaParams.audio);console.log("Video constraints",mediaParams.video);if(self.options.useVideo&&self.options.localVideo){getUserMedia({constraints:{audio:false,video:{mandatory:self.options.videoParams,optional:[]},},localVideo:self.options.localVideo,onsuccess:function(e){self.options.localVideoStream=e;console.log("local video ready");},onerror:function(e){console.error("local video error!");}});}
-getUserMedia({constraints:{audio:mediaParams.audio,video:mediaParams.video},video:mediaParams.useVideo,onsuccess:onSuccess,onerror:onError});};function getMediaParams(obj){var audio;if(obj.options.videoParams&&obj.options.videoParams.chromeMediaSource=='desktop'){console.error("SCREEN SHARE");audio=false;}else{audio={mandatory:obj.options.audioParams,optional:[]};if(obj.options.useMic!=="any"){audio.optional=[{sourceId:obj.options.useMic}]}}
+getUserMedia({constraints:{audio:mediaParams.audio,video:mediaParams.video},video:mediaParams.useVideo,onsuccess:onSuccess,onerror:onError});};function getMediaParams(obj){var audio;if(obj.options.videoParams&&obj.options.screenShare){console.error("SCREEN SHARE");audio=false;}else{audio={mandatory:obj.options.audioParams,optional:[]};if(obj.options.useMic!=="any"){audio.optional=[{sourceId:obj.options.useMic}]}}
if(obj.options.useVideo&&obj.options.localVideo){getUserMedia({constraints:{audio:false,video:{mandatory:obj.options.videoParams,optional:[]},},localVideo:obj.options.localVideo,onsuccess:function(e){self.options.localVideoStream=e;console.log("local video ready");},onerror:function(e){console.error("local video error!");}});}
var video={mandatory:obj.options.videoParams,optional:[]}
var useVideo=obj.options.useVideo;if(useVideo&&obj.options.useCamera&&obj.options.useCamera!=="none"){if(obj.options.useCamera!=="any"){video.optional=[{sourceId:obj.options.useCamera}]}}else{video=null;useVideo=null;}
return{audio:audio,video:video,useVideo:useVideo};}
-$.FSRTC.prototype.call=function(profile){checkCompat();var self=this;var screen=false;self.type="offer";if(self.options.videoParams&&self.options.videoParams.chromeMediaSource=='desktop'){screen=true;}
+$.FSRTC.prototype.call=function(profile){checkCompat();var self=this;var screen=false;self.type="offer";if(self.options.videoParams&&self.options.screenShare){screen=true;}
function onSuccess(stream){self.localStream=stream;self.peer=RTCPeerConnection({type:self.type,attachStream:self.localStream,onICE:function(candidate){return onICE(self,candidate);},onICEComplete:function(){return onICEComplete(self);},onRemoteStream:screen?function(stream){console.error("SKIP");}:function(stream){return onRemoteStream(self,stream);},onOfferSDP:function(sdp){return onOfferSDP(self,sdp);},onICESDP:function(sdp){return onICESDP(self,sdp);},onChannelError:function(e){return onChannelError(self,e);},constraints:self.constraints,iceServers:self.options.iceServers,});onStreamSuccess(self,stream);}
function onError(e){onStreamError(self,e);}
var mediaParams=getMediaParams(self);console.log("Audio constraints",mediaParams.audio);console.log("Video constraints",mediaParams.video);getUserMedia({constraints:{audio:mediaParams.audio,video:mediaParams.video},video:mediaParams.useVideo,onsuccess:onSuccess,onerror:onError});};window.moz=!!navigator.mozGetUserMedia;function RTCPeerConnection(options){var w=window,PeerConnection=w.mozRTCPeerConnection||w.webkitRTCPeerConnection,SessionDescription=w.mozRTCSessionDescription||w.RTCSessionDescription,IceCandidate=w.mozRTCIceCandidate||w.RTCIceCandidate;var STUN={url:!moz?'stun:stun.l.google.com:19302':'stun:23.21.150.121'};var TURN={url:'turn:homeo@turn.bistri.com:80',credential:'homeo'};var iceServers=null;if(options.iceServers){var tmp=options.iceServers;if(typeof(tmp)==="boolean"){tmp=null;}
diff --git a/html5/verto/video_demo/verto.js b/html5/verto/video_demo/verto.js
index 71f6a7763d..b577d0efd0 100644
--- a/html5/verto/video_demo/verto.js
+++ b/html5/verto/video_demo/verto.js
@@ -573,9 +573,31 @@ function doshare(on) {
if (share_call) {
return;
}
+
+ var sharedev = $("#useshare").find(":selected").val();
+
+ if (sharedev !== "screen") {
+
+ share_call = verto.newCall({
+ destination_number: $("#ext").val() + "-screen",
+ caller_id_name: $("#cidname").val() + " (Screen)",
+ caller_id_number: $("#cid").val() + " (screen)",
+ outgoingBandwidth: outgoingBandwidth,
+ incomingBandwidth: incomingBandwidth,
+ useCamera: sharedev,
+ useVideo: true,
+ screenShare: true
+ });
+
+ return;
+ }
+
+
console.log("Attempting Screen Capture....");
getScreenId(function (error, sourceId, screen_constraints) {
+
+
share_call = verto.newCall({
destination_number: $("#ext").val() + "-screen",
caller_id_name: $("#cidname").val() + " (Screen)",
@@ -639,6 +661,7 @@ var devinit = false;
function refresh_devices()
{
if (devinit) {
+ $("#useshare").empty();
$("#usecamera").empty();
$("#usemic").empty();
}
@@ -647,14 +670,22 @@ function refresh_devices()
$.verto.findDevices(function() {
var x = 0;
+
$("#usecamera").append(new Option("No Camera", "none"));
for (var i in $.verto.videoDevices) {
var source = $.verto.videoDevices[i];
var o = new Option(source.label, source.id);
- if (!x++) {
+ if (!x) {
o.selected = true;
}
$("#usecamera").append(o);
+
+ var oo = new Option(source.label, source.id);
+ if (!x++) {
+ o.selected = true;
+ }
+
+ $("#useshare").append(oo);
}
x = 0;
@@ -667,9 +698,17 @@ function refresh_devices()
}
$("#usemic").append(o);
}
+
+
+ var o = new Option("Screen", "screen");
+ o.selected = true;
+
+ $("#useshare").append(o);
+
$("#usecamera").selectmenu('refresh', true);
$("#usemic").selectmenu('refresh', true);
+ $("#useshare").selectmenu('refresh', true);
//console.error($("#usecamera").find(":selected").val());