Browse Source

Add events to notify Firefox screen sharing extension when screen sharing starts and stops.

pull/236/head
Evan Theurer 10 years ago
parent
commit
b824eff0cd
  1. 3
      static/js/directives/screenshare.js
  2. 14
      static/js/services/screensharing.js

3
static/js/directives/screenshare.js

@ -172,6 +172,7 @@ define(['jquery', 'underscore', 'text!partials/screenshare.html', 'text!partials @@ -172,6 +172,7 @@ define(['jquery', 'underscore', 'text!partials/screenshare.html', 'text!partials
}
$scope.layout.screenshare = true;
screensharing.globalNotify().screensharingStart();
screensharing.getScreen().then(function(options) {
if (options) {
$scope.startScreenshare(options);
@ -307,6 +308,8 @@ define(['jquery', 'underscore', 'text!partials/screenshare.html', 'text!partials @@ -307,6 +308,8 @@ define(['jquery', 'underscore', 'text!partials/screenshare.html', 'text!partials
$scope.layout.screenshare = false;
}
screensharing.globalNotify().screensharingStop();
};
$scope.toggleFullscreen = function(elem) {

14
static/js/services/screensharing.js

@ -32,6 +32,9 @@ define(['underscore', 'text!partials/screensharedialogff.html', 'webrtc.adapter' @@ -32,6 +32,9 @@ define(['underscore', 'text!partials/screensharedialogff.html', 'webrtc.adapter'
};
}];
var GLOBAL_SCREENSHARING_START_EVENT = new Event('webrtcStartScreensharing');
var GLOBAL_SCREENSHARING_STOP_EVENT = new Event('webrtcStopScreensharing');
// screensharing
return ["$window", "$q", "$timeout", "chromeExtension", "dialogs", "$templateCache", function($window, $q, $timeout, chromeExtension, dialogs, $templateCache) {
@ -45,6 +48,17 @@ define(['underscore', 'text!partials/screensharedialogff.html', 'webrtc.adapter' @@ -45,6 +48,17 @@ define(['underscore', 'text!partials/screensharedialogff.html', 'webrtc.adapter'
}, this));
};
Screensharing.prototype.globalNotify = function() {
return {
screensharingStart: function() {
$window.dispatchEvent(GLOBAL_SCREENSHARING_START_EVENT);
},
screensharingStop: function() {
$window.dispatchEvent(GLOBAL_SCREENSHARING_STOP_EVENT);
}
};
};
Screensharing.prototype.initialize = function() {
// Check if we can do screensharing.

Loading…
Cancel
Save