mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-06-27 11:47:41 +00:00
FS-9242 fix screen share for chrome to work in VC with additional camera
This commit is contained in:
parent
2ea20cca1b
commit
4bab51e306
@ -520,8 +520,17 @@
|
|||||||
|
|
||||||
if (obj.options.screenShare) {
|
if (obj.options.screenShare) {
|
||||||
// fix for chrome to work for now, will need to change once we figure out how to do this in a non-mandatory style constraint.
|
// fix for chrome to work for now, will need to change once we figure out how to do this in a non-mandatory style constraint.
|
||||||
|
var opt = [];
|
||||||
|
opt.push({sourceId: obj.options.useCamera});
|
||||||
|
|
||||||
|
if (bestFrameRate) {
|
||||||
|
opt.push({minFrameRate: bestFrameRate});
|
||||||
|
opt.push({maxFrameRate: bestFrameRate});
|
||||||
|
}
|
||||||
|
|
||||||
video = {
|
video = {
|
||||||
mandatory: obj.options.videoParams
|
mandatory: obj.options.videoParams,
|
||||||
|
optional: opt
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
@ -824,10 +824,64 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
|
|||||||
},
|
},
|
||||||
|
|
||||||
screenshare: function(destination, callback) {
|
screenshare: function(destination, callback) {
|
||||||
console.log('share screen video');
|
|
||||||
|
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
|
if (storage.data.selectedShare !== "screen") {
|
||||||
|
|
||||||
|
console.log('share screen from device ' + storage.data.selectedShare);
|
||||||
|
|
||||||
|
var call = data.instance.newCall({
|
||||||
|
destination_number: destination + "-screen",
|
||||||
|
caller_id_name: data.name + " (Screen)",
|
||||||
|
caller_id_number: data.login + " (screen)",
|
||||||
|
outgoingBandwidth: storage.data.outgoingBandwidth,
|
||||||
|
incomingBandwidth: storage.data.incomingBandwidth,
|
||||||
|
useCamera: storage.data.selectedShare,
|
||||||
|
useVideo: true,
|
||||||
|
screenShare: true,
|
||||||
|
dedEnc: storage.data.useDedenc,
|
||||||
|
mirrorInput: storage.data.mirrorInput,
|
||||||
|
userVariables: {
|
||||||
|
email : storage.data.email,
|
||||||
|
avatar: "http://gravatar.com/avatar/" + md5(storage.data.email) + ".png?s=600"
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Override onStream callback in $.FSRTC instance
|
||||||
|
call.rtc.options.callbacks.onStream = function(rtc, stream) {
|
||||||
|
if(stream) {
|
||||||
|
var StreamTrack = stream.getVideoTracks()[0];
|
||||||
|
StreamTrack.addEventListener('ended', stopSharing);
|
||||||
|
// (stream.getVideoTracks()[0]).onended = stopSharing;
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("screenshare started");
|
||||||
|
|
||||||
|
function stopSharing() {
|
||||||
|
if(that.data.shareCall) {
|
||||||
|
that.screenshareHangup();
|
||||||
|
console.log("screenshare ended");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
data.shareCall = call;
|
||||||
|
|
||||||
|
console.log('shareCall', data);
|
||||||
|
|
||||||
|
data.mutedMic = false;
|
||||||
|
data.mutedVideo = false;
|
||||||
|
|
||||||
|
that.refreshDevices();
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
console.log('share screen from plugin');
|
||||||
|
|
||||||
getScreenId(function(error, sourceId, screen_constraints) {
|
getScreenId(function(error, sourceId, screen_constraints) {
|
||||||
|
|
||||||
if(error) {
|
if(error) {
|
||||||
@ -842,7 +896,7 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
|
|||||||
outgoingBandwidth: storage.data.outgoingBandwidth,
|
outgoingBandwidth: storage.data.outgoingBandwidth,
|
||||||
incomingBandwidth: storage.data.incomingBandwidth,
|
incomingBandwidth: storage.data.incomingBandwidth,
|
||||||
videoParams: screen_constraints.video.mandatory,
|
videoParams: screen_constraints.video.mandatory,
|
||||||
useVideo: storage.data.useVideo,
|
useVideo: true,
|
||||||
screenShare: true,
|
screenShare: true,
|
||||||
dedEnc: storage.data.useDedenc,
|
dedEnc: storage.data.useDedenc,
|
||||||
mirrorInput: storage.data.mirrorInput,
|
mirrorInput: storage.data.mirrorInput,
|
||||||
|
3
html5/verto/video_demo/js/verto-min.js
vendored
3
html5/verto/video_demo/js/verto-min.js
vendored
@ -46,7 +46,8 @@ var mediaParams=getMediaParams(self);console.log("Audio constraints",mediaParams
|
|||||||
getUserMedia({constraints:{audio:mediaParams.audio,video:mediaParams.video},video:mediaParams.useVideo,onsuccess:onSuccess,onerror:onError});};function getMediaParams(obj){var audio;if(obj.options.useMic&&obj.options.useMic==="none"){console.log("Microphone Disabled");audio=false;}else if(obj.options.videoParams&&obj.options.screenShare){console.error("SCREEN SHARE",obj.options.videoParams);audio=false;}else{audio={advanced:[]};if(obj.options.useMic!=="any"){audio.deviceId={exact: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.useMic&&obj.options.useMic==="none"){console.log("Microphone Disabled");audio=false;}else if(obj.options.videoParams&&obj.options.screenShare){console.error("SCREEN SHARE",obj.options.videoParams);audio=false;}else{audio={advanced:[]};if(obj.options.useMic!=="any"){audio.deviceId={exact:obj.options.useMic};}
|
||||||
if(obj.options.audioParams){for(var key in obj.options.audioParams){var con={};if(obj.options.audioParams[key]){con.exact=key;audio.advanced.push(con);}}}}
|
if(obj.options.audioParams){for(var key in obj.options.audioParams){var con={};if(obj.options.audioParams[key]){con.exact=key;audio.advanced.push(con);}}}}
|
||||||
if(obj.options.useVideo&&obj.options.localVideo){getUserMedia({constraints:{audio:false,video:obj.options.videoParams},localVideo:obj.options.localVideo,onsuccess:function(e){self.options.localVideoStream=e;console.log("local video ready");},onerror:function(e){console.error("local video error!");}});}
|
if(obj.options.useVideo&&obj.options.localVideo){getUserMedia({constraints:{audio:false,video:obj.options.videoParams},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={};var bestFrameRate=obj.options.videoParams.vertoBestFrameRate;var minFrameRate=obj.options.videoParams.minFrameRate||15;delete obj.options.videoParams.vertoBestFrameRate;if(obj.options.screenShare){video={mandatory:obj.options.videoParams};}else{video={width:{min:obj.options.videoParams.minWidth,max:obj.options.videoParams.maxWidth},height:{min:obj.options.videoParams.minHeight,max:obj.options.videoParams.maxHeight}};var useVideo=obj.options.useVideo;if(useVideo&&obj.options.useCamera&&obj.options.useCamera!=="none"){if(obj.options.useCamera!=="any"){video.deviceId=obj.options.useCamera;}
|
var video={};var bestFrameRate=obj.options.videoParams.vertoBestFrameRate;var minFrameRate=obj.options.videoParams.minFrameRate||15;delete obj.options.videoParams.vertoBestFrameRate;if(obj.options.screenShare){var opt=[];opt.push({sourceId:obj.options.useCamera});if(bestFrameRate){opt.push({minFrameRate:bestFrameRate});opt.push({maxFrameRate:bestFrameRate});}
|
||||||
|
video={mandatory:obj.options.videoParams,optional:opt};}else{video={width:{min:obj.options.videoParams.minWidth,max:obj.options.videoParams.maxWidth},height:{min:obj.options.videoParams.minHeight,max:obj.options.videoParams.maxHeight}};var useVideo=obj.options.useVideo;if(useVideo&&obj.options.useCamera&&obj.options.useCamera!=="none"){if(obj.options.useCamera!=="any"){video.deviceId=obj.options.useCamera;}
|
||||||
if(bestFrameRate){video.frameRate={ideal:bestFrameRate,min:minFrameRate,max:30};}}else{console.log("Camera Disabled");video=false;useVideo=false;}}
|
if(bestFrameRate){video.frameRate={ideal:bestFrameRate,min:minFrameRate,max:30};}}else{console.log("Camera Disabled");video=false;useVideo=false;}}
|
||||||
return{audio:audio,video:video,useVideo:useVideo};}
|
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.screenShare){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;}
|
||||||
|
@ -1091,6 +1091,13 @@ function refresh_devices()
|
|||||||
pop_select("#usecamera","verto_demo_camera_selected", tmp);
|
pop_select("#usecamera","verto_demo_camera_selected", tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var tmp;
|
||||||
|
tmp = $.cookie("verto_demo_share_selected") || "false";
|
||||||
|
if (tmp) {
|
||||||
|
$('#useshare option[value=' + tmp + ']').prop('selected', 'selected').change();
|
||||||
|
pop_select("#useshare","verto_demo_share_selected", tmp);
|
||||||
|
}
|
||||||
|
|
||||||
tmp = $.cookie("verto_demo_mic_selected") || "false";
|
tmp = $.cookie("verto_demo_mic_selected") || "false";
|
||||||
if (tmp) {
|
if (tmp) {
|
||||||
$('#usemic option[value=' + tmp + ']').prop('selected', 'selected').change();
|
$('#usemic option[value=' + tmp + ']').prop('selected', 'selected').change();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user