ep_webrtc 2.0.0 → 2.0.3
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/adapter.js +2 -2
- package/static/js/index.js +10 -3
package/package.json
CHANGED
package/static/js/adapter.js
CHANGED
|
@@ -2405,7 +2405,7 @@ function shimCreateOfferLegacy(window) {
|
|
|
2405
2405
|
}
|
|
2406
2406
|
}
|
|
2407
2407
|
} else if (offerOptions.offerToReceiveAudio === true && !audioTransceiver) {
|
|
2408
|
-
this.addTransceiver('audio');
|
|
2408
|
+
this.addTransceiver('audio', { direction: 'recvonly' });
|
|
2409
2409
|
}
|
|
2410
2410
|
|
|
2411
2411
|
if (typeof offerOptions.offerToReceiveVideo !== 'undefined') {
|
|
@@ -2430,7 +2430,7 @@ function shimCreateOfferLegacy(window) {
|
|
|
2430
2430
|
}
|
|
2431
2431
|
}
|
|
2432
2432
|
} else if (offerOptions.offerToReceiveVideo === true && !videoTransceiver) {
|
|
2433
|
-
this.addTransceiver('video');
|
|
2433
|
+
this.addTransceiver('video', { direction: 'recvonly' });
|
|
2434
2434
|
}
|
|
2435
2435
|
}
|
|
2436
2436
|
return origCreateOffer.apply(this, arguments);
|
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}) {
|
|
@@ -1235,6 +1239,9 @@ exports.rtc = new class {
|
|
|
1235
1239
|
}
|
|
1236
1240
|
|
|
1237
1241
|
sendMessage(to, data) {
|
|
1242
|
+
if (data.ids == null) data.ids = {};
|
|
1243
|
+
if (data.ids.from == null) data.ids.from = {};
|
|
1244
|
+
data.ids.from.session = sessionId;
|
|
1238
1245
|
debug(`(${to == null ? 'to everyone on the pad' : `peer ${to}`}) sending message`, data);
|
|
1239
1246
|
this._pad.collabClient.sendMessage({
|
|
1240
1247
|
type: 'RTC_MESSAGE',
|
|
@@ -1272,7 +1279,7 @@ exports.rtc = new class {
|
|
|
1272
1279
|
// the WebRTC signaling messages. This is bad because WebRTC assumes reliable, in-order delivery
|
|
1273
1280
|
// of signaling messages, so the discards will break future connection attempts.
|
|
1274
1281
|
invitePeer(userId) {
|
|
1275
|
-
this.sendMessage(userId, {
|
|
1282
|
+
this.sendMessage(userId, {invite: 'invite'});
|
|
1276
1283
|
}
|
|
1277
1284
|
|
|
1278
1285
|
getPeerConnection(userId) {
|