Browse Source

Added selection to make screen, window and application possible in Firefox.

pull/188/head
Simon Eisenmann 10 years ago
parent
commit
c5a91562fc
  1. 35
      static/js/services/screensharing.js
  2. 22
      static/partials/screensharedialogff.html

35
static/js/services/screensharing.js

@ -20,10 +20,22 @@ @@ -20,10 +20,22 @@
*/
"use strict";
define(['underscore', 'webrtc.adapter'], function(_) {
define(['underscore', 'text!partials/screensharedialogff.html', 'webrtc.adapter'], function(_, screenshareDialogFF) {
var screenshareDialogFFController = ["$scope", "$modalInstance", "data", function($scope, $modalInstance, data) {
$scope.data = data;
$scope.cancel = function() {
$modalInstance.close(null);
};
$scope.ok = function() {
$modalInstance.close($scope.data.selection);
};
}];
// screensharing
return ["$window", "$q", "$timeout", "chromeExtension", function($window, $q, $timeout, chromeExtension) {
return ["$window", "$q", "$timeout", "chromeExtension", "dialogs", "$templateCache", function($window, $q, $timeout, chromeExtension, dialogs, $templateCache) {
$templateCache.put('/dialogs/screensharedialogff.html', screenshareDialogFF);
var Screensharing = function() {
this.autoinstall = false;
@ -131,11 +143,20 @@ define(['underscore', 'webrtc.adapter'], function(_) { @@ -131,11 +143,20 @@ define(['underscore', 'webrtc.adapter'], function(_) {
// To work, the current domain must be whitelisted in
// media.getusermedia.screensharing.allowed_domains (about:config).
// See https://wiki.mozilla.org/Screensharing for reference.
var d = $q.defer()
var opts = _.extend({
mediaSource: "screen"
}, options);
d.resolve(opts);
var d = $q.defer();
var dlg = dialogs.create('/dialogs/screensharedialogff.html', screenshareDialogFFController, {selection: "screen"}, {});
dlg.result.then(function(source) {
if (source) {
var opts = _.extend({
mediaSource: source
}, options);
d.resolve(opts);
} else {
d.resolve(null);
}
}, function(err) {
d.resolve(null);
});
return d.promise;
};
}

22
static/partials/screensharedialogff.html

@ -0,0 +1,22 @@ @@ -0,0 +1,22 @@
<div>
<div class="modal-header"><button type="button" class="close" ng-click="$close()">×</button><h3 class="modal-title">{{_("Share screen")}}</h3></div>
<div class="modal-body">
<ng-form name="promptDialog" novalidate role="form">
<h4>{{_("Please select what to share.")}}</h4>
<div class="btn-group">
<label class="btn btn-default" ng-model="data.selection" btn-radio="'screen'">{{_("Screen")}}</label>
<label class="btn btn-default" ng-model="data.selection" btn-radio="'window'">{{_("Window")}}</label>
<label class="btn btn-default" ng-model="data.selection" btn-radio="'application'">{{_("Application")}}</label>
</div>
<div ng-switch="data.selection">
<span class="help-block" ng-switch-when="screen">Share the whole screen. Click share to select the screen.</span>
<span class="help-block" ng-switch-when="window">Share a single window. Click share to select the window.</span>
<span class="help-block" ng-switch-when="application">Share all windows of a application. This can leak content behind windows when windows get moved. Click share to select the application.</span>
</div>
</ng-form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" ng-click="cancel()">{{_("Cancel")}}</button>
<button type="button" class="btn btn-primary" ng-click="ok()" ng-disabled="(promptDialog.$dirty && promptDialog.$invalid) || !data.selection">{{_("Share")}}</button>
</div>
</div>
Loading…
Cancel
Save