mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-08-13 09:36:46 +00:00
FS-8222 [verto_communicator] updated getScreenId.js in order to detect plugin issues and attached an 'ended' event to screenshare stream in order to detect 'stop sharing' click
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
if (storage.data.videoCall) {
|
||||
$scope.callTemplate = 'partials/video_call.html';
|
||||
}
|
||||
|
||||
|
||||
$rootScope.$on('call.conference', function(event, data) {
|
||||
$timeout(function() {
|
||||
if($scope.chatStatus) {
|
||||
@@ -75,9 +75,31 @@
|
||||
verto.data.conf.setVideoLayout(layout);
|
||||
};
|
||||
|
||||
|
||||
$scope.screenshare = function() {
|
||||
if(verto.data.shareCall) {
|
||||
verto.screenshareHangup();
|
||||
return false;
|
||||
}
|
||||
verto.screenshare(storage.data.called_number);
|
||||
};
|
||||
|
||||
$scope.muteMic = verto.muteMic;
|
||||
$scope.muteVideo = verto.muteVideo;
|
||||
|
||||
$scope.$on('ScreenShareExtensionStatus', function(error) {
|
||||
switch(error) {
|
||||
case 'permission-denied':
|
||||
toastr.info('Please allow the plugin in order to use Screen Share', 'Error'); break;
|
||||
case 'not-installed':
|
||||
toastr.warning('Please install the plugin in order to use Screen Share', 'Warning'); break;
|
||||
case 'installed-disabled':
|
||||
toastr.info('Please enable the plugin in order to use Screen Share', 'Error'); break;
|
||||
// case 'not-chrome'
|
||||
// toastr.info('Please allow the plugin in order to use Screen Share', 'Error');
|
||||
}
|
||||
});
|
||||
|
||||
$timeout(function() {
|
||||
console.log('broadcast time-start incall');
|
||||
$scope.$broadcast('timer-start');
|
||||
|
@@ -24,13 +24,13 @@
|
||||
* @type {string}
|
||||
*/
|
||||
$rootScope.dialpadNumber = '';
|
||||
|
||||
|
||||
// If verto is not connected, redirects to login page.
|
||||
if (!verto.data.connected) {
|
||||
console.debug('MainController: WebSocket not connected. Redirecting to login.');
|
||||
$location.path('/');
|
||||
}
|
||||
|
||||
|
||||
$rootScope.$on('config.http.success', function(ev) {
|
||||
$scope.login(false);
|
||||
});
|
||||
@@ -58,7 +58,7 @@
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
verto.data.connecting = true;
|
||||
verto.connect(connectCallback);
|
||||
};
|
||||
@@ -135,7 +135,7 @@
|
||||
templateUrl: templateUrl,
|
||||
controller: controller,
|
||||
};
|
||||
|
||||
|
||||
angular.extend(options, _options);
|
||||
|
||||
var modalInstance = $modal.open(options);
|
||||
@@ -154,7 +154,7 @@
|
||||
jQuery.material.init();
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
return modalInstance;
|
||||
};
|
||||
|
||||
@@ -454,14 +454,6 @@
|
||||
$scope.incomingCall = false;
|
||||
};
|
||||
|
||||
$scope.screenshare = function() {
|
||||
if (verto.data.shareCall) {
|
||||
verto.screenshareHangup();
|
||||
return false;
|
||||
}
|
||||
verto.screenshare(storage.data.called_number);
|
||||
};
|
||||
|
||||
$scope.play = function() {
|
||||
var file = $scope.promptInput('Please, enter filename', '', 'File',
|
||||
function(file) {
|
||||
|
@@ -169,7 +169,7 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
|
||||
var height = res[1];
|
||||
|
||||
if(resolution.width == width && resolution.height == height) {
|
||||
videoQuality.push(resolution);
|
||||
videoQuality.push(resolution);
|
||||
}
|
||||
});
|
||||
});
|
||||
@@ -200,9 +200,9 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
|
||||
|
||||
refreshDevicesCallback : function refreshDevicesCallback(callback) {
|
||||
data.videoDevices = [{
|
||||
id: 'none',
|
||||
label: 'No Camera'
|
||||
}];
|
||||
id: 'none',
|
||||
label: 'No Camera'
|
||||
}];
|
||||
data.shareDevices = [{
|
||||
id: 'screen',
|
||||
label: 'Screen'
|
||||
@@ -556,10 +556,10 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
|
||||
// Checking if we have a failed connection attempt before
|
||||
// connecting again.
|
||||
if (data.instance && !data.instance.rpcClient.socketReady()) {
|
||||
clearTimeout(data.instance.rpcClient.to);
|
||||
data.instance.logout();
|
||||
data.instance.login();
|
||||
return;
|
||||
clearTimeout(data.instance.rpcClient.to);
|
||||
data.instance.logout();
|
||||
data.instance.login();
|
||||
return;
|
||||
};
|
||||
data.instance = new jQuery.verto({
|
||||
login: data.login + '@' + data.hostname,
|
||||
@@ -583,22 +583,22 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
|
||||
jQuery.verto.unloadJobs.push(function() {
|
||||
that.reloaded = true;
|
||||
});
|
||||
data.instance.deviceParams({
|
||||
useCamera: storage.data.selectedVideo,
|
||||
useMic: storage.data.selectedAudio,
|
||||
onResCheck: that.refreshVideoResolution
|
||||
});
|
||||
data.instance.deviceParams({
|
||||
useCamera: storage.data.selectedVideo,
|
||||
useMic: storage.data.selectedAudio,
|
||||
onResCheck: that.refreshVideoResolution
|
||||
});
|
||||
}
|
||||
|
||||
if (data.mediaPerm) {
|
||||
ourBootstrap();
|
||||
} else {
|
||||
$.FSRTC.checkPerms(ourBootstrap, true, true);
|
||||
$.FSRTC.checkPerms(ourBootstrap, true, true);
|
||||
}
|
||||
},
|
||||
|
||||
mediaPerm: function(callback) {
|
||||
$.FSRTC.checkPerms(callback, true, true);
|
||||
$.FSRTC.checkPerms(callback, true, true);
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -681,6 +681,12 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
|
||||
var that = this;
|
||||
|
||||
getScreenId(function(error, sourceId, screen_constraints) {
|
||||
|
||||
if(error) {
|
||||
$rootScope.$emit('ScreenShareExtensionStatus', error);
|
||||
return;
|
||||
}
|
||||
|
||||
var call = data.instance.newCall({
|
||||
destination_number: destination + '-screen',
|
||||
caller_id_name: data.name + ' (Screen)',
|
||||
@@ -698,6 +704,24 @@ vertoService.service('verto', ['$rootScope', '$cookieStore', '$location', 'stora
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
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("stream started");
|
||||
|
||||
function stopSharing() {
|
||||
if(that.data.shareCall) {
|
||||
that.screenshareHangup();
|
||||
console.log("screenshare ended");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
data.shareCall = call;
|
||||
|
||||
console.log('shareCall', data);
|
||||
|
Reference in New Issue
Block a user