Browse Source

Added code to check for screensharing support.

pull/76/head
Simon Eisenmann 11 years ago
parent
commit
ef53aa9c9c
  1. 2
      html/main.html
  2. 7
      static/js/controllers/mediastreamcontroller.js
  3. 51
      static/js/services/screensharing.js
  4. 9
      static/js/services/services.js

2
html/main.html

@ -23,7 +23,7 @@
<ul class="nav navbar-nav navbar-right right"> <ul class="nav navbar-nav navbar-right right">
<li class="ng-cloak"> <li class="ng-cloak">
<button title="{{_('Present a file')}}" class="btn aenablebtn" ng-show="status=='connected' || status=='conference' || layout.presentation" ng-model="layout.presentation" btn-checkbox><i class="fa fa-folder-open-o"></i></button> <button title="{{_('Present a file')}}" class="btn aenablebtn" ng-show="status=='connected' || status=='conference' || layout.presentation" ng-model="layout.presentation" btn-checkbox><i class="fa fa-folder-open-o"></i></button>
<button title="{{_('Share your screen')}}" class="btn aenablebtn" ng-show="isChrome && webrtcDetectedVersion >= 32 && (status=='connected' || status=='conference' || layout.screenshare)" ng-model="layout.screenshare" btn-checkbox><i class="fa fa-desktop"></i></button> <button title="{{_('Share your screen')}}" class="btn aenablebtn" ng-disabled="!supported.screensharing" ng-show="status=='connected' || status=='conference' || layout.screenshare" ng-model="layout.screenshare" btn-checkbox><i class="fa fa-desktop"></i></button>
<button title="{{_('Chat')}}" class="btn" ng-class="{messagesunseen: chatMessagesUnseen>0}" ng-model="layout.chat" btn-checkbox btn-checkbox-true="true" btn-checkbox-false="false"><i class="fa fa-comments-o"></i><span class="badge" ng-show="chatMessagesUnseen" ng-bind="chatMessagesUnseen"></span></button> <button title="{{_('Chat')}}" class="btn" ng-class="{messagesunseen: chatMessagesUnseen>0}" ng-model="layout.chat" btn-checkbox btn-checkbox-true="true" btn-checkbox-false="false"><i class="fa fa-comments-o"></i><span class="badge" ng-show="chatMessagesUnseen" ng-bind="chatMessagesUnseen"></span></button>
<button title="{{_('Mute microphone')}}" class="btn amutebtn" ng-model="microphoneMute" btn-checkbox btn-checkbox-true="true" btn-checkbox-false="false"><i class="fa fa-microphone-slash"></i></button> <button title="{{_('Mute microphone')}}" class="btn amutebtn" ng-model="microphoneMute" btn-checkbox btn-checkbox-true="true" btn-checkbox-false="false"><i class="fa fa-microphone-slash"></i></button>
<button title="{{_('Turn camera off')}}" class="btn amutebtn" ng-model="cameraMute" btn-checkbox btn-checkbox-true="true" btn-checkbox-false="false"><i class="fa fa-eye-slash"></i></button> <button title="{{_('Turn camera off')}}" class="btn amutebtn" ng-model="cameraMute" btn-checkbox btn-checkbox-true="true" btn-checkbox-false="false"><i class="fa fa-eye-slash"></i></button>

7
static/js/controllers/mediastreamcontroller.js

@ -20,7 +20,7 @@
*/ */
define(['underscore', 'bigscreen', 'moment', 'sjcl', 'modernizr', 'webrtc.adapter'], function(_, BigScreen, moment, sjcl, Modernizr) { define(['underscore', 'bigscreen', 'moment', 'sjcl', 'modernizr', 'webrtc.adapter'], function(_, BigScreen, moment, sjcl, Modernizr) {
return ["$scope", "$rootScope", "$element", "$window", "$timeout", "safeDisplayName", "safeApply", "mediaStream", "appData", "playSound", "desktopNotify", "alertify", "toastr", "translation", "fileDownload", "localStorage", function($scope, $rootScope, $element, $window, $timeout, safeDisplayName, safeApply, mediaStream, appData, playSound, desktopNotify, alertify, toastr, translation, fileDownload, localStorage) { return ["$scope", "$rootScope", "$element", "$window", "$timeout", "safeDisplayName", "safeApply", "mediaStream", "appData", "playSound", "desktopNotify", "alertify", "toastr", "translation", "fileDownload", "localStorage", "screensharing", function($scope, $rootScope, $element, $window, $timeout, safeDisplayName, safeApply, mediaStream, appData, playSound, desktopNotify, alertify, toastr, translation, fileDownload, localStorage, screensharing) {
/*console.log("route", $route, $routeParams, $location);*/ /*console.log("route", $route, $routeParams, $location);*/
@ -119,6 +119,11 @@ define(['underscore', 'bigscreen', 'moment', 'sjcl', 'modernizr', 'webrtc.adapte
$scope.webrtcDetectedBrowser = $window.webrtcDetectedBrowser; $scope.webrtcDetectedBrowser = $window.webrtcDetectedBrowser;
$scope.webrtcDetectedVersion = $window.webrtcDetectedVersion; $scope.webrtcDetectedVersion = $window.webrtcDetectedVersion;
// Add support status.
$scope.supported = {
screensharing: screensharing.supported
}
// Default scope data. // Default scope data.
$scope.status = "initializing"; $scope.status = "initializing";
$scope.id = null; $scope.id = null;

51
static/js/services/screensharing.js

@ -0,0 +1,51 @@
/*
* Spreed WebRTC.
* Copyright (C) 2013-2014 struktur AG
*
* This file is part of Spreed WebRTC.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
define(['webrtc.adapter'], function() {
// screensharing
return ["$window", function($window) {
// Check if we can do screensharing.
var supported = false;
if ($window.webrtcDetectedBrowser === "chrome") {
if ($window.webrtcDetectedVersion >= 32 &&
$window.webrtcDetectedVersion < 37) {
// Support for flag based developer screen sharing came in Chrome 32.
// It was removed in Chrome 37 in favour of chrome.chooseDesktopMedia
// https://code.google.com/p/chromium/issues/detail?id=347641
supported = true;
} else if ($window.webrtcDetectedVersion >= 37) {
// We need a extension to support screen sharing. See
// https://developer.chrome.com/extensions/desktopCapture#method-chooseDesktopMedia
// for details.
}
} else {
// Currently Chrome only.
}
// public API.
return {
supported: supported
}
}];
});

9
static/js/services/services.js

@ -51,7 +51,8 @@ define([
'services/localstorage', 'services/localstorage',
'services/animationframe', 'services/animationframe',
'services/dialogs', 'services/dialogs',
'services/geolocation'], function(_, 'services/geolocation',
'services/screensharing'], function(_,
desktopNotify, desktopNotify,
playSound, playSound,
safeApply, safeApply,
@ -82,7 +83,8 @@ buddySession,
localStorage, localStorage,
animationFrame, animationFrame,
dialogs, dialogs,
geolocation) { geolocation,
screensharing) {
var services = { var services = {
desktopNotify: desktopNotify, desktopNotify: desktopNotify,
@ -115,7 +117,8 @@ geolocation) {
localStorage: localStorage, localStorage: localStorage,
animationFrame: animationFrame, animationFrame: animationFrame,
dialogs: dialogs, dialogs: dialogs,
geolocation: geolocation geolocation: geolocation,
screensharing: screensharing
}; };
var initialize = function(angModule) { var initialize = function(angModule) {

Loading…
Cancel
Save