10 changed files with 294 additions and 59 deletions
@ -0,0 +1,62 @@
@@ -0,0 +1,62 @@
|
||||
/* |
||||
* 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/>.
|
||||
* |
||||
*/ |
||||
|
||||
/* global Promise */ |
||||
"use strict"; |
||||
define(['webrtc.adapter'], function() { |
||||
|
||||
// mediaDevices
|
||||
return ["$window", function($window) { |
||||
|
||||
var mediaDevices = $window.navigator.mediaDevices || {}; |
||||
var getUserMedia = (function() { |
||||
// Implement a Promise based wrapper around getUserMedia.
|
||||
if (mediaDevices.getUserMedia) { |
||||
// mediaDevices calls return Promise native.
|
||||
return mediaDevices.getUserMedia.bind(mediaDevices); |
||||
} else { |
||||
return function getUserMedia(constraints) { |
||||
return new Promise(function(resolve, reject) { |
||||
var onSuccess = function(stream) { |
||||
resolve(stream) |
||||
}; |
||||
var onError = function(error) { |
||||
reject(error); |
||||
}; |
||||
try { |
||||
$window.getUserMedia(constraints, onSuccess, onError); |
||||
} catch(err) { |
||||
onError(err); |
||||
} |
||||
}); |
||||
} |
||||
} |
||||
})(); |
||||
|
||||
// Public api.
|
||||
return { |
||||
shim: mediaDevices.getUserMedia ? false : true, |
||||
getUserMedia: getUserMedia |
||||
} |
||||
|
||||
}]; |
||||
|
||||
}); |
@ -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…
Reference in new issue