Browse Source

Merged DummyStream implementations into one.

pull/206/head
Simon Eisenmann 10 years ago
parent
commit
ff433f12a4
  1. 10
      static/js/directives/audiovideo.js
  2. 42
      static/js/mediastream/dummystream.js
  3. 12
      static/js/mediastream/usermedia.js
  4. 29
      static/js/services/dummystream.js
  5. 9
      static/js/services/services.js

10
static/js/directives/audiovideo.js

@ -22,7 +22,7 @@
"use strict"; "use strict";
define(['jquery', 'underscore', 'text!partials/audiovideo.html', 'text!partials/audiovideopeer.html', 'bigscreen', 'webrtc.adapter'], function($, _, template, templatePeer, BigScreen) { define(['jquery', 'underscore', 'text!partials/audiovideo.html', 'text!partials/audiovideopeer.html', 'bigscreen', 'webrtc.adapter'], function($, _, template, templatePeer, BigScreen) {
return ["$window", "$compile", "$filter", "mediaStream", "safeApply", "desktopNotify", "buddyData", "videoWaiter", "videoLayout", "animationFrame", "$timeout", function($window, $compile, $filter, mediaStream, safeApply, desktopNotify, buddyData, videoWaiter, videoLayout, animationFrame, $timeout) { return ["$window", "$compile", "$filter", "mediaStream", "safeApply", "desktopNotify", "buddyData", "videoWaiter", "videoLayout", "animationFrame", "$timeout", "dummyStream", function($window, $compile, $filter, mediaStream, safeApply, desktopNotify, buddyData, videoWaiter, videoLayout, animationFrame, $timeout, DummyStream) {
var peerTemplate = $compile(templatePeer); var peerTemplate = $compile(templatePeer);
@ -37,14 +37,6 @@ define(['jquery', 'underscore', 'text!partials/audiovideo.html', 'text!partials/
return id; return id;
}; };
// Dummy stream.
var DummyStream = function() {};
DummyStream.prototype.id = "defaultDummyStream";
DummyStream.prototype.stop = function() {};
DummyStream.is = function(stream) {
return stream && stream.stop === DummyStream.prototype.stop;
};
$scope.container = $element[0]; $scope.container = $element[0];
$scope.layoutparent = $element.parent(); $scope.layoutparent = $element.parent();

42
static/js/mediastream/dummystream.js

@ -0,0 +1,42 @@
/*
* Spreed WebRTC.
* Copyright (C) 2013-2015 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/>.
*
*/
"use strict";
define([], function() {
// Dummy stream implementation.
var DummyStream = function(id) {
this.id = id ? id : "defaultDummyStream";
};
DummyStream.prototype.stop = function() {};
DummyStream.prototype.getAudioTracks = function() { return [] };
DummyStream.prototype.getVideoTracks = function() { return [] };
DummyStream.not = function(stream) {
// Helper to test if stream is a dummy.
return !stream || stream.stop !== DummyStream.prototype.stop;
};
DummyStream.is = function(stream) {
return !this.not(stream);
};
return DummyStream;
});

12
static/js/mediastream/usermedia.js

@ -20,7 +20,7 @@
*/ */
"use strict"; "use strict";
define(['jquery', 'underscore', 'audiocontext', 'webrtc.adapter'], function($, _, AudioContext) { define(['jquery', 'underscore', 'audiocontext', 'mediastream/dummystream', 'webrtc.adapter'], function($, _, AudioContext, DummyStream) {
// Create AudioContext singleton, if supported. // Create AudioContext singleton, if supported.
var context = AudioContext ? new AudioContext() : null; var context = AudioContext ? new AudioContext() : null;
@ -119,16 +119,6 @@ define(['jquery', 'underscore', 'audiocontext', 'webrtc.adapter'], function($, _
} }
})(); })();
// Create a dummy stream.
var DummyStream = function() {};
DummyStream.prototype.stop = function() {};
DummyStream.prototype.getAudioTracks = function() { return [] };
DummyStream.prototype.getVideoTracks = function() { return [] };
DummyStream.not = function(stream) {
// Helper to test if stream is a dummy.
return !stream || stream.stop !== DummyStream.prototype.stop;
};
// UserMedia. // UserMedia.
var UserMedia = function(options) { var UserMedia = function(options) {

29
static/js/services/dummystream.js

@ -0,0 +1,29 @@
/*
* Spreed WebRTC.
* Copyright (C) 2013-2015 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/>.
*
*/
"use strict";
define([
'mediastream/dummystream'
], function(DummyStream) {
return [function() {
return DummyStream;
}];
});

9
static/js/services/services.js

@ -68,7 +68,8 @@ define([
'services/constraints', 'services/constraints',
'services/modules', 'services/modules',
'services/mediadevices', 'services/mediadevices',
'services/sandbox'], function(_, 'services/sandbox',
'services/dummystream'], function(_,
desktopNotify, desktopNotify,
playSound, playSound,
safeApply, safeApply,
@ -114,7 +115,8 @@ roompin,
constraints, constraints,
modules, modules,
mediaDevices, mediaDevices,
sandbox) { sandbox,
dummyStream) {
var services = { var services = {
desktopNotify: desktopNotify, desktopNotify: desktopNotify,
@ -162,7 +164,8 @@ sandbox) {
constraints: constraints, constraints: constraints,
modules: modules, modules: modules,
mediaDevices: mediaDevices, mediaDevices: mediaDevices,
sandbox: sandbox sandbox: sandbox,
dummyStream: dummyStream
}; };
var initialize = function(angModule) { var initialize = function(angModule) {

Loading…
Cancel
Save