@flashphoner/sfusdk 1.0.41 → 2.0.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/examples/sfu.d.ts +13 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/sdk/connection.d.ts +25 -0
- package/dist/sdk/connection.js +101 -0
- package/dist/sdk/connection.js.map +1 -0
- package/dist/sdk/constants.d.ts +355 -0
- package/dist/sdk/constants.js +190 -0
- package/dist/sdk/constants.js.map +1 -0
- package/dist/sdk/logger.d.ts +10 -0
- package/dist/sdk/logger.js +22 -0
- package/dist/sdk/logger.js.map +1 -0
- package/dist/sdk/notifier.d.ts +7 -0
- package/dist/sdk/notifier.js +52 -0
- package/dist/sdk/notifier.js.map +1 -0
- package/dist/sdk/promises.d.ts +11 -0
- package/{src/sdk/promise.js → dist/sdk/promises.js} +14 -13
- package/dist/sdk/promises.js.map +1 -0
- package/dist/sdk/room-extended.d.ts +13 -0
- package/dist/sdk/room-extended.js +112 -0
- package/dist/sdk/room-extended.js.map +1 -0
- package/dist/sdk/room.d.ts +30 -0
- package/dist/sdk/room.js +384 -0
- package/dist/sdk/room.js.map +1 -0
- package/dist/sdk/sfu-extended.d.ts +126 -0
- package/dist/sdk/sfu-extended.js +511 -0
- package/dist/sdk/sfu-extended.js.map +1 -0
- package/dist/sdk/sfu.d.ts +22 -0
- package/dist/sdk/sfu.js +136 -0
- package/dist/sdk/sfu.js.map +1 -0
- package/dist/src/index.d.ts +6 -0
- package/dist/src/sdk/connection.d.ts +25 -0
- package/dist/src/sdk/constants.d.ts +355 -0
- package/dist/src/sdk/logger.d.ts +10 -0
- package/dist/src/sdk/notifier.d.ts +7 -0
- package/dist/src/sdk/promises.d.ts +11 -0
- package/dist/src/sdk/room-extended.d.ts +13 -0
- package/dist/src/sdk/room.d.ts +30 -0
- package/dist/src/sdk/sfu-extended.d.ts +126 -0
- package/dist/src/sdk/sfu.d.ts +22 -0
- package/package.json +27 -24
- package/Gruntfile.js +0 -79
- package/README.md +0 -95
- package/dependencies/bootstrap/css/bootstrap-theme.css +0 -587
- package/dependencies/bootstrap/css/bootstrap-theme.css.map +0 -1
- package/dependencies/bootstrap/css/bootstrap-theme.min.css +0 -5
- package/dependencies/bootstrap/css/bootstrap.css +0 -6853
- package/dependencies/bootstrap/css/bootstrap.css.map +0 -1
- package/dependencies/bootstrap/css/bootstrap.min.css +0 -5
- package/dependencies/bootstrap/font-awesome/HELP-US-OUT.txt +0 -7
- package/dependencies/bootstrap/font-awesome/css/font-awesome.css +0 -2178
- package/dependencies/bootstrap/font-awesome/css/font-awesome.min.css +0 -4
- package/dependencies/bootstrap/font-awesome/fonts/FontAwesome.otf +0 -0
- package/dependencies/bootstrap/font-awesome/fonts/fontawesome-webfont.eot +0 -0
- package/dependencies/bootstrap/font-awesome/fonts/fontawesome-webfont.svg +0 -685
- package/dependencies/bootstrap/font-awesome/fonts/fontawesome-webfont.ttf +0 -0
- package/dependencies/bootstrap/font-awesome/fonts/fontawesome-webfont.woff +0 -0
- package/dependencies/bootstrap/font-awesome/fonts/fontawesome-webfont.woff2 +0 -0
- package/dependencies/bootstrap/font-awesome/less/animated.less +0 -34
- package/dependencies/bootstrap/font-awesome/less/bordered-pulled.less +0 -25
- package/dependencies/bootstrap/font-awesome/less/core.less +0 -12
- package/dependencies/bootstrap/font-awesome/less/fixed-width.less +0 -6
- package/dependencies/bootstrap/font-awesome/less/font-awesome.less +0 -18
- package/dependencies/bootstrap/font-awesome/less/icons.less +0 -724
- package/dependencies/bootstrap/font-awesome/less/larger.less +0 -13
- package/dependencies/bootstrap/font-awesome/less/list.less +0 -19
- package/dependencies/bootstrap/font-awesome/less/mixins.less +0 -60
- package/dependencies/bootstrap/font-awesome/less/path.less +0 -15
- package/dependencies/bootstrap/font-awesome/less/rotated-flipped.less +0 -20
- package/dependencies/bootstrap/font-awesome/less/screen-reader.less +0 -5
- package/dependencies/bootstrap/font-awesome/less/stacked.less +0 -20
- package/dependencies/bootstrap/font-awesome/less/variables.less +0 -735
- package/dependencies/bootstrap/font-awesome/scss/_animated.scss +0 -34
- package/dependencies/bootstrap/font-awesome/scss/_bordered-pulled.scss +0 -25
- package/dependencies/bootstrap/font-awesome/scss/_core.scss +0 -12
- package/dependencies/bootstrap/font-awesome/scss/_fixed-width.scss +0 -6
- package/dependencies/bootstrap/font-awesome/scss/_icons.scss +0 -724
- package/dependencies/bootstrap/font-awesome/scss/_larger.scss +0 -13
- package/dependencies/bootstrap/font-awesome/scss/_list.scss +0 -19
- package/dependencies/bootstrap/font-awesome/scss/_mixins.scss +0 -60
- package/dependencies/bootstrap/font-awesome/scss/_path.scss +0 -15
- package/dependencies/bootstrap/font-awesome/scss/_rotated-flipped.scss +0 -20
- package/dependencies/bootstrap/font-awesome/scss/_screen-reader.scss +0 -5
- package/dependencies/bootstrap/font-awesome/scss/_stacked.scss +0 -20
- package/dependencies/bootstrap/font-awesome/scss/_variables.scss +0 -735
- package/dependencies/bootstrap/font-awesome/scss/font-awesome.scss +0 -18
- package/dependencies/bootstrap/fonts/FontAwesome.otf +0 -0
- package/dependencies/bootstrap/fonts/fontawesome-webfont.eot +0 -0
- package/dependencies/bootstrap/fonts/fontawesome-webfont.svg +0 -655
- package/dependencies/bootstrap/fonts/fontawesome-webfont.ttf +0 -0
- package/dependencies/bootstrap/fonts/fontawesome-webfont.woff +0 -0
- package/dependencies/bootstrap/fonts/fontawesome-webfont.woff2 +0 -0
- package/dependencies/bootstrap/fonts/glyphicons-halflings-regular.eot +0 -0
- package/dependencies/bootstrap/fonts/glyphicons-halflings-regular.svg +0 -288
- package/dependencies/bootstrap/fonts/glyphicons-halflings-regular.ttf +0 -0
- package/dependencies/bootstrap/fonts/glyphicons-halflings-regular.woff +0 -0
- package/dependencies/bootstrap/fonts/glyphicons-halflings-regular.woff2 +0 -0
- package/dependencies/bootstrap/icons/font-awesome.min.css +0 -4
- package/dependencies/bootstrap/js/bootstrap.js +0 -2363
- package/dependencies/bootstrap/js/bootstrap.min.js +0 -7
- package/dependencies/bootstrap/js/npm.js +0 -13
- package/dependencies/bootstrap/js/switch.js +0 -85
- package/dependencies/jquery/jquery-1.12.0.js +0 -11027
- package/dependencies/jquery/jquery-ui.js +0 -16617
- package/dependencies/jquery/jquery.js +0 -8981
- package/dependencies/jquery/jquery.json.js +0 -199
- package/dependencies/jquery/jquery.websocket.js +0 -61
- package/dependencies/sigma/sigma.layout.forceAtlas2.min.js +0 -1
- package/dependencies/sigma/sigma.layout.noverlap.min.js +0 -1
- package/dependencies/sigma/sigma.min.js +0 -2
- package/dependencies/sigma/sigma.plugins.relativeSize.min.js +0 -1
- package/dependencies/sigma/sigma.renderers.edgeLabels.min.js +0 -1
- package/dependencies/sigma/sigma.renderers.parallelEdges.min.js +0 -1
- package/dependencies/sigma/sigma.require.js +0 -12076
- package/docTemplate/README.md +0 -5
- package/docTemplate/publish.js +0 -654
- package/docTemplate/static/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/docTemplate/static/fonts/OpenSans-Bold-webfont.svg +0 -1830
- package/docTemplate/static/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/docTemplate/static/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/docTemplate/static/fonts/OpenSans-BoldItalic-webfont.svg +0 -1830
- package/docTemplate/static/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/docTemplate/static/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/docTemplate/static/fonts/OpenSans-Italic-webfont.svg +0 -1830
- package/docTemplate/static/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/docTemplate/static/fonts/OpenSans-Light-webfont.eot +0 -0
- package/docTemplate/static/fonts/OpenSans-Light-webfont.svg +0 -1831
- package/docTemplate/static/fonts/OpenSans-Light-webfont.woff +0 -0
- package/docTemplate/static/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/docTemplate/static/fonts/OpenSans-LightItalic-webfont.svg +0 -1835
- package/docTemplate/static/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/docTemplate/static/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/docTemplate/static/fonts/OpenSans-Regular-webfont.svg +0 -1831
- package/docTemplate/static/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/docTemplate/static/scripts/linenumber.js +0 -25
- package/docTemplate/static/scripts/prettify/Apache-License-2.0.txt +0 -202
- package/docTemplate/static/scripts/prettify/lang-css.js +0 -2
- package/docTemplate/static/scripts/prettify/prettify.js +0 -28
- package/docTemplate/static/styles/jsdoc-default.css +0 -354
- package/docTemplate/static/styles/prettify-jsdoc.css +0 -111
- package/docTemplate/static/styles/prettify-tomorrow.css +0 -132
- package/docTemplate/tmpl/augments.tmpl +0 -10
- package/docTemplate/tmpl/container.tmpl +0 -183
- package/docTemplate/tmpl/details.tmpl +0 -143
- package/docTemplate/tmpl/example.tmpl +0 -2
- package/docTemplate/tmpl/examples.tmpl +0 -13
- package/docTemplate/tmpl/exceptions.tmpl +0 -32
- package/docTemplate/tmpl/layout.tmpl +0 -38
- package/docTemplate/tmpl/mainpage.tmpl +0 -14
- package/docTemplate/tmpl/members.tmpl +0 -38
- package/docTemplate/tmpl/method.tmpl +0 -105
- package/docTemplate/tmpl/params.tmpl +0 -124
- package/docTemplate/tmpl/properties.tmpl +0 -108
- package/docTemplate/tmpl/returns.tmpl +0 -19
- package/docTemplate/tmpl/source.tmpl +0 -8
- package/docTemplate/tmpl/tutorial.tmpl +0 -19
- package/docTemplate/tmpl/type.tmpl +0 -7
- package/src/examples/client/chat.js +0 -67
- package/src/examples/client/config.json +0 -26
- package/src/examples/client/controls.js +0 -314
- package/src/examples/client/display.js +0 -502
- package/src/examples/client/main.css +0 -45
- package/src/examples/client/main.html +0 -220
- package/src/examples/client/main.js +0 -156
- package/src/examples/client/resources/details_close.png +0 -0
- package/src/examples/client/resources/details_open.png +0 -0
- package/src/examples/client/util.js +0 -67
- package/src/examples/commons/js/config.js +0 -81
- package/src/examples/commons/js/display.js +0 -484
- package/src/examples/commons/js/util.js +0 -202
- package/src/examples/commons/media/silence.mp3 +0 -0
- package/src/examples/controller/dependencies/sigma/sigma.renderers.edgeLabels.min.js +0 -1
- package/src/examples/controller/dependencies/sigma/sigma.renderers.parallelEdges.min.js +0 -1
- package/src/examples/controller/dependencies/sigma/sigma.require.js +0 -12076
- package/src/examples/controller/graph-view.js +0 -32
- package/src/examples/controller/main.css +0 -45
- package/src/examples/controller/main.html +0 -79
- package/src/examples/controller/main.js +0 -65
- package/src/examples/controller/parser.js +0 -202
- package/src/examples/controller/resources/details_close.png +0 -0
- package/src/examples/controller/resources/details_open.png +0 -0
- package/src/examples/controller/rest.js +0 -56
- package/src/examples/controller/table-view.js +0 -64
- package/src/examples/controller/test-data.js +0 -382
- package/src/examples/player/config.json +0 -8
- package/src/examples/player/player.css +0 -19
- package/src/examples/player/player.html +0 -54
- package/src/examples/player/player.js +0 -209
- package/src/examples/two-way-streaming/config.json +0 -34
- package/src/examples/two-way-streaming/two-way-streaming.css +0 -26
- package/src/examples/two-way-streaming/two-way-streaming.html +0 -72
- package/src/examples/two-way-streaming/two-way-streaming.js +0 -375
- package/src/sdk/constants.js +0 -488
- package/src/sdk/messaging.js +0 -59
- package/src/sdk/room.js +0 -442
- package/src/sdk/sfu-extended.js +0 -513
- package/src/sdk/sfu.js +0 -179
- package/src/sdk/ws.js +0 -109
- package/src/tests/sdk/sfu-extended.test.js +0 -151
|
@@ -1,314 +0,0 @@
|
|
|
1
|
-
const createControls = function(config) {
|
|
2
|
-
|
|
3
|
-
let trackCallback = function(){};
|
|
4
|
-
|
|
5
|
-
const controls = {
|
|
6
|
-
entrance: {
|
|
7
|
-
url: document.getElementById("url"),
|
|
8
|
-
roomName: document.getElementById("roomName"),
|
|
9
|
-
roomPin: document.getElementById("roomPin"),
|
|
10
|
-
nickName: document.getElementById("nickName"),
|
|
11
|
-
enter: document.getElementById("startButton")
|
|
12
|
-
},
|
|
13
|
-
addVideoTrack: {
|
|
14
|
-
source: document.getElementById("addVideoTrackSource"),
|
|
15
|
-
width: document.getElementById("addVideoTrackWidth"),
|
|
16
|
-
height: document.getElementById("addVideoTrackHeight"),
|
|
17
|
-
codec: document.getElementById("addVideoTrackCodec")
|
|
18
|
-
},
|
|
19
|
-
addAudioTrack: {
|
|
20
|
-
source: document.getElementById("addAudioTrackSource"),
|
|
21
|
-
channels: document.getElementById("addAudioTrackChannels")
|
|
22
|
-
},
|
|
23
|
-
addVideoEncoding: {
|
|
24
|
-
rid: document.getElementById("addVideoTrackEncodingRid"),
|
|
25
|
-
active: document.getElementById("addVideoTrackEncodingActive"),
|
|
26
|
-
maxBitrate: document.getElementById("addVideoTrackEncodingMaxBitrate"),
|
|
27
|
-
resolutionScale: document.getElementById("addVideoTrackEncodingResolutionScale")
|
|
28
|
-
},
|
|
29
|
-
tables: {
|
|
30
|
-
video: $('#videoTracksTable').DataTable({
|
|
31
|
-
"sDom": 't',
|
|
32
|
-
"columns": [
|
|
33
|
-
{
|
|
34
|
-
"className": 'details-control',
|
|
35
|
-
"orderable": false,
|
|
36
|
-
"data": null,
|
|
37
|
-
"defaultContent": ''
|
|
38
|
-
},
|
|
39
|
-
{"data": "source"},
|
|
40
|
-
{"data": "width"},
|
|
41
|
-
{"data": "height"},
|
|
42
|
-
{"data": "codec"},
|
|
43
|
-
{"data": "action"}
|
|
44
|
-
]
|
|
45
|
-
}),
|
|
46
|
-
audio: $('#audioTracksTable').DataTable({
|
|
47
|
-
"sDom": 't',
|
|
48
|
-
"columns": [
|
|
49
|
-
{"data": "source"},
|
|
50
|
-
{"data": "channels"},
|
|
51
|
-
{"data": "action"}
|
|
52
|
-
]
|
|
53
|
-
}),
|
|
54
|
-
encodings: $('#videoTrackEncodingsTable').DataTable({
|
|
55
|
-
"sDom": 't',
|
|
56
|
-
"columns": [
|
|
57
|
-
{"data": "rid"},
|
|
58
|
-
{"data": "active"},
|
|
59
|
-
{"data": "maxBitrate"},
|
|
60
|
-
{"data": "resolutionScale"},
|
|
61
|
-
{"data": "action"}
|
|
62
|
-
]
|
|
63
|
-
})
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
//apply room config
|
|
68
|
-
controls.entrance.url.value = config.room.url;
|
|
69
|
-
controls.entrance.roomName.value = config.room.name;
|
|
70
|
-
controls.entrance.roomPin.value = config.room.pin;
|
|
71
|
-
controls.entrance.nickName.value = config.room.nickName;
|
|
72
|
-
|
|
73
|
-
const addAudioTrackRow = function(track) {
|
|
74
|
-
getMedia([track]).then(function(stream){
|
|
75
|
-
let button = '<button id="' + stream.id + '-button" class="btn btn-primary">Delete</button>';
|
|
76
|
-
const row = controls.tables.audio.row.add({
|
|
77
|
-
source: track.source,
|
|
78
|
-
channels: track.channels,
|
|
79
|
-
action: button,
|
|
80
|
-
stream: stream
|
|
81
|
-
}).node();
|
|
82
|
-
controls.tables.audio.draw();
|
|
83
|
-
|
|
84
|
-
$('#' + stream.id + "-button").on('click', function(){
|
|
85
|
-
//terminate stream
|
|
86
|
-
console.log("terminate stream " + stream.id);
|
|
87
|
-
let track = stream.getAudioTracks()[0];
|
|
88
|
-
track.stop();
|
|
89
|
-
track.dispatchEvent(new Event("ended"));
|
|
90
|
-
});
|
|
91
|
-
stream.getTracks()[0].onended = function() {
|
|
92
|
-
controls.tables.audio.row(row).remove().draw();
|
|
93
|
-
}
|
|
94
|
-
trackCallback({
|
|
95
|
-
stream: stream,
|
|
96
|
-
encodings: track.encodings,
|
|
97
|
-
source: track.source
|
|
98
|
-
});
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const addVideoTrackRow = function(track) {
|
|
103
|
-
getMedia([track]).then(function(stream){
|
|
104
|
-
let button = '<button id="' + stream.id + '-button" class="btn btn-primary">Delete</button>';
|
|
105
|
-
const row = controls.tables.video.row.add({
|
|
106
|
-
source: track.source,
|
|
107
|
-
width: track.width,
|
|
108
|
-
height: track.height,
|
|
109
|
-
codec: track.codec,
|
|
110
|
-
action: button,
|
|
111
|
-
stream: stream,
|
|
112
|
-
encodings: track.encodings
|
|
113
|
-
}).node();
|
|
114
|
-
controls.tables.video.draw();
|
|
115
|
-
|
|
116
|
-
$('#' + stream.id + "-button").on('click', function(){
|
|
117
|
-
//terminate stream
|
|
118
|
-
console.log("terminate stream " + stream.id);
|
|
119
|
-
let track = stream.getVideoTracks()[0];
|
|
120
|
-
track.stop();
|
|
121
|
-
track.dispatchEvent(new Event("ended"));
|
|
122
|
-
});
|
|
123
|
-
stream.getTracks()[0].addEventListener("ended", function() {
|
|
124
|
-
controls.tables.video.row(row).remove().draw();
|
|
125
|
-
});
|
|
126
|
-
trackCallback({
|
|
127
|
-
stream: stream,
|
|
128
|
-
encodings: track.encodings,
|
|
129
|
-
source: track.source
|
|
130
|
-
});
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const format = function(d) {
|
|
135
|
-
if (!d.encodings) {
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
let details = '<table cellpadding="5" cellspacing="0" border="0" style="padding-left:50px;">';
|
|
139
|
-
d.encodings.forEach(function(encoding){
|
|
140
|
-
details += '<tr>';
|
|
141
|
-
for (const [key, value] of Object.entries(encoding)) {
|
|
142
|
-
details += '<td>'+ key + '</td>'+
|
|
143
|
-
'<td>'+ value + '</td>';
|
|
144
|
-
}
|
|
145
|
-
details += '</tr>';
|
|
146
|
-
});
|
|
147
|
-
details +='</table>';
|
|
148
|
-
return details;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
// Add event listener for opening and closing details
|
|
152
|
-
$('#videoTracksTableBody').on('click', 'td.details-control', function () {
|
|
153
|
-
let tr = $(this).closest('tr');
|
|
154
|
-
let row = controls.tables.video.row(tr);
|
|
155
|
-
if (row.child.isShown()) {
|
|
156
|
-
// This row is already open - close it
|
|
157
|
-
row.child.hide();
|
|
158
|
-
tr.removeClass('shown');
|
|
159
|
-
} else {
|
|
160
|
-
// Open this row
|
|
161
|
-
row.child(format(row.data())).show();
|
|
162
|
-
tr.addClass('shown');
|
|
163
|
-
}
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
config.media.audio.tracks.forEach(function(track){
|
|
167
|
-
addAudioTrackRow(track);
|
|
168
|
-
})
|
|
169
|
-
config.media.video.tracks.forEach(function(track){
|
|
170
|
-
addVideoTrackRow(track);
|
|
171
|
-
})
|
|
172
|
-
|
|
173
|
-
const muteForm = function(form) {
|
|
174
|
-
for (const [key, value] of Object.entries(form)) {
|
|
175
|
-
value.disabled = true;
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
const unmuteForm = function(form) {
|
|
180
|
-
for (const [key, value] of Object.entries(form)) {
|
|
181
|
-
value.disabled = false;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
const muteInput = function() {
|
|
186
|
-
muteForm(controls.entrance);
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
const roomConfig = function() {
|
|
190
|
-
return {
|
|
191
|
-
url: controls.entrance.url.value,
|
|
192
|
-
roomName: controls.entrance.roomName.value,
|
|
193
|
-
pin: controls.entrance.roomPin.value,
|
|
194
|
-
nickname: controls.entrance.nickName.value
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
const getVideoStreams = function() {
|
|
199
|
-
let streams = [];
|
|
200
|
-
controls.tables.video.rows().every(function(rowIdx, tableLoop, rowLoop) {
|
|
201
|
-
let data = this.data();
|
|
202
|
-
streams.push({
|
|
203
|
-
stream: data.stream,
|
|
204
|
-
encodings: data.encodings,
|
|
205
|
-
source: data.source
|
|
206
|
-
});
|
|
207
|
-
});
|
|
208
|
-
return streams;
|
|
209
|
-
}
|
|
210
|
-
const getAudioStreams = function() {
|
|
211
|
-
let streams = [];
|
|
212
|
-
controls.tables.audio.rows().every(function(rowIdx, tableLoop, rowLoop) {
|
|
213
|
-
let data = this.data();
|
|
214
|
-
streams.push({
|
|
215
|
-
stream: data.stream,
|
|
216
|
-
encodings: [],
|
|
217
|
-
source: data.source
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
return streams;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
document.getElementById("addVideoTrack").addEventListener("click", function(e){
|
|
224
|
-
let encodings = [];
|
|
225
|
-
controls.tables.encodings.rows().every(function() {
|
|
226
|
-
let encoding = this.data();
|
|
227
|
-
encodings.push({
|
|
228
|
-
rid: encoding.rid,
|
|
229
|
-
active: encoding.active,
|
|
230
|
-
maxBitrate: encoding.maxBitrate,
|
|
231
|
-
scaleResolutionDownBy: encoding.resolutionScale
|
|
232
|
-
})
|
|
233
|
-
});
|
|
234
|
-
let track = {
|
|
235
|
-
source: controls.addVideoTrack.source.value,
|
|
236
|
-
width: controls.addVideoTrack.width.value,
|
|
237
|
-
height: controls.addVideoTrack.height.value,
|
|
238
|
-
codec: controls.addVideoTrack.codec.value,
|
|
239
|
-
encodings: encodings
|
|
240
|
-
}
|
|
241
|
-
addVideoTrackRow(track);
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
$("#videoTrackEncodingsTable").on("click", ".remove", function(){
|
|
245
|
-
controls.tables.encodings.row($(this).parents('tr')).remove().draw();
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
document.getElementById("addVideoTrackEncoding").addEventListener("click", function(){
|
|
249
|
-
let button = '<button class="btn btn-primary remove">Delete</button>';
|
|
250
|
-
controls.tables.encodings.row.add({
|
|
251
|
-
rid: controls.addVideoEncoding.rid.value,
|
|
252
|
-
active: controls.addVideoEncoding.active.value,
|
|
253
|
-
maxBitrate: controls.addVideoEncoding.maxBitrate.value,
|
|
254
|
-
resolutionScale: controls.addVideoEncoding.resolutionScale.value,
|
|
255
|
-
action: button
|
|
256
|
-
}).draw();
|
|
257
|
-
});
|
|
258
|
-
|
|
259
|
-
document.getElementById("addAudioTrack").addEventListener("click", function(e){
|
|
260
|
-
let encodings = [];
|
|
261
|
-
let track = {
|
|
262
|
-
source: controls.addAudioTrack.source.value,
|
|
263
|
-
channels: controls.addAudioTrack.channels.value,
|
|
264
|
-
encodings: encodings
|
|
265
|
-
}
|
|
266
|
-
addAudioTrackRow(track);
|
|
267
|
-
});
|
|
268
|
-
|
|
269
|
-
const onTrack = function(callback) {
|
|
270
|
-
trackCallback = callback;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
return {
|
|
275
|
-
muteInput: muteInput,
|
|
276
|
-
roomConfig: roomConfig,
|
|
277
|
-
getAudioStreams: getAudioStreams,
|
|
278
|
-
getVideoStreams: getVideoStreams,
|
|
279
|
-
onTrack: onTrack
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
|
|
283
|
-
const getMedia = async function(tracks) {
|
|
284
|
-
//convert to constraints
|
|
285
|
-
let screen = false;
|
|
286
|
-
const constraints= {};
|
|
287
|
-
tracks.forEach(function(track){
|
|
288
|
-
if (track.source === "mic") {
|
|
289
|
-
//audio
|
|
290
|
-
constraints.audio = {};
|
|
291
|
-
constraints.audio.stereo = track.channels !== 1
|
|
292
|
-
} else if (track.source === "camera") {
|
|
293
|
-
constraints.video = {
|
|
294
|
-
width: track.width,
|
|
295
|
-
height: track.height
|
|
296
|
-
};
|
|
297
|
-
} else if (track.source === "screen") {
|
|
298
|
-
constraints.video = {
|
|
299
|
-
width: track.width,
|
|
300
|
-
height: track.height
|
|
301
|
-
};
|
|
302
|
-
screen = true;
|
|
303
|
-
}
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
//get access to a/v
|
|
307
|
-
let stream;
|
|
308
|
-
if (screen) {
|
|
309
|
-
stream = await navigator.mediaDevices.getDisplayMedia(constraints);
|
|
310
|
-
} else {
|
|
311
|
-
stream = await navigator.mediaDevices.getUserMedia(constraints);
|
|
312
|
-
}
|
|
313
|
-
return stream;
|
|
314
|
-
}
|