-
Notifications
You must be signed in to change notification settings - Fork 10
/
moz.js
48 lines (37 loc) · 967 Bytes
/
moz.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
var detect = require('rtc-core/detect');
var EventEmitter = require('eventemitter3');
var targets = {};
targets.window = function(callback) {
callback(null, {
video: {
mozMediaSource: 'window',
mediaSource: 'window'
}
});
};
/**
Returns true if we should use Firefox screensharing
**/
exports.supported = function() {
return detect.moz;
};
exports.share = function(opts) {
opts = opts || {};
var target = opts.target || 'window';
var capture = targets[target];
var extension = new EventEmitter();
extension.type = 'mozilla/firefox';
extension.available = function(callback) {
if (typeof capture != 'function') {
return callback(new Error(target + ' capture not implemented'), 'not-supported');
}
return callback();
};
extension.request = function(callback) {
return capture(callback);
};
extension.cancel = function(callback) {
};
extension.emit('activate');
return extension;
};