ep_webrtc 2.0.1 → 2.0.4
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/package.json +1 -1
- package/static/js/index.js +14 -4
package/package.json
CHANGED
package/static/js/index.js
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
require('./adapter');
|
|
19
19
|
const padcookie = require('ep_etherpad-lite/static/js/pad_cookie').padcookie;
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
let enableDebugLogging = false;
|
|
22
22
|
const debug = (...args) => { if (enableDebugLogging) console.debug('ep_webrtc:', ...args); };
|
|
23
23
|
|
|
24
24
|
const EventTargetPolyfill = (() => {
|
|
@@ -220,6 +220,7 @@ class PeerState extends EventTargetPolyfill {
|
|
|
220
220
|
return;
|
|
221
221
|
}
|
|
222
222
|
this._debug('creating RTCPeerConnection with config', this._pcConfig);
|
|
223
|
+
this._debug('peer IDs:', peerIds);
|
|
223
224
|
this._setRemoteStream(null);
|
|
224
225
|
this._ids.from.instance = ++nextInstanceId;
|
|
225
226
|
this._ids.to = peerIds;
|
|
@@ -341,7 +342,7 @@ class PeerState extends EventTargetPolyfill {
|
|
|
341
342
|
}
|
|
342
343
|
|
|
343
344
|
async receiveMessage(msg) {
|
|
344
|
-
if (this._closed) return
|
|
345
|
+
if (this._closed) return this._debug('Ignoring message because PeerState is closed');
|
|
345
346
|
const {ids, candidate, description, hangup} = msg;
|
|
346
347
|
if (hangup != null) {
|
|
347
348
|
this.close(true);
|
|
@@ -464,6 +465,9 @@ exports.rtc = new class {
|
|
|
464
465
|
this._trackLocks = {audio: new Mutex(), video: new Mutex()};
|
|
465
466
|
}
|
|
466
467
|
|
|
468
|
+
get enableDebugLogging() { return enableDebugLogging; }
|
|
469
|
+
set enableDebugLogging(val) { enableDebugLogging = !!val; }
|
|
470
|
+
|
|
467
471
|
// API HOOKS
|
|
468
472
|
|
|
469
473
|
async postAceInit(hookName, {pad}) {
|
|
@@ -882,7 +886,10 @@ exports.rtc = new class {
|
|
|
882
886
|
autoplay: '',
|
|
883
887
|
muted: isLocal ? '' : null,
|
|
884
888
|
})
|
|
885
|
-
.prop(
|
|
889
|
+
.prop({
|
|
890
|
+
muted: isLocal, // Setting the 'muted' attribute isn't sufficient for some reason.
|
|
891
|
+
volume: isLocal ? 0.0 : 1.0, // Long shot attempt at fixing echo in Safari.
|
|
892
|
+
});
|
|
886
893
|
const $interface = $('<div>')
|
|
887
894
|
.addClass('interface-container')
|
|
888
895
|
.attr('id', `interface_${videoId}`);
|
|
@@ -1235,6 +1242,9 @@ exports.rtc = new class {
|
|
|
1235
1242
|
}
|
|
1236
1243
|
|
|
1237
1244
|
sendMessage(to, data) {
|
|
1245
|
+
if (data.ids == null) data.ids = {};
|
|
1246
|
+
if (data.ids.from == null) data.ids.from = {};
|
|
1247
|
+
data.ids.from.session = sessionId;
|
|
1238
1248
|
debug(`(${to == null ? 'to everyone on the pad' : `peer ${to}`}) sending message`, data);
|
|
1239
1249
|
this._pad.collabClient.sendMessage({
|
|
1240
1250
|
type: 'RTC_MESSAGE',
|
|
@@ -1272,7 +1282,7 @@ exports.rtc = new class {
|
|
|
1272
1282
|
// the WebRTC signaling messages. This is bad because WebRTC assumes reliable, in-order delivery
|
|
1273
1283
|
// of signaling messages, so the discards will break future connection attempts.
|
|
1274
1284
|
invitePeer(userId) {
|
|
1275
|
-
this.sendMessage(userId, {
|
|
1285
|
+
this.sendMessage(userId, {invite: 'invite'});
|
|
1276
1286
|
}
|
|
1277
1287
|
|
|
1278
1288
|
getPeerConnection(userId) {
|