@dimchansky/meshpost 0.6.0 → 0.7.0
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/blob.js +36 -36
- package/dist/channel.d.ts +4 -0
- package/dist/channel.js +4 -0
- package/dist/combine.d.ts +9 -2
- package/dist/combine.js +35 -33
- package/dist/index.d.ts +2 -1
- package/dist/mqtt.js +59 -109
- package/dist/nostr.js +71 -131
- package/dist/peer-link.js +983 -0
- package/dist/presence.js +74 -0
- package/dist/public.js +16 -23
- package/dist/relay-core.js +219 -143
- package/dist/room-reclaim.js +5 -1
- package/dist/room.js +300 -463
- package/dist/rpc.js +25 -28
- package/dist/signaling.js +2 -11
- package/dist/state.js +22 -31
- package/dist/tabs.js +6 -50
- package/dist/voice-mic.js +496 -0
- package/dist/voice-remote.js +568 -0
- package/dist/voice.d.ts +8 -0
- package/dist/voice.js +71 -816
- package/dist/ws.js +20 -58
- package/docs/adr/0001-room-internals-and-channel-budget.md +31 -0
- package/docs/api.md +6 -4
- package/docs/behavior.md +4 -4
- package/package.json +4 -2
- package/dist/room-hello.js +0 -129
- package/dist/room-ice.js +0 -115
- package/dist/room-media.js +0 -477
- package/dist/voice-helpers.js +0 -100
- package/dist/voice-meter.d.ts +0 -1
- package/dist/voice-meter.js +0 -79
- /package/dist/{room-hello.d.ts → peer-link.d.ts} +0 -0
- /package/dist/{room-ice.d.ts → presence.d.ts} +0 -0
- /package/dist/{room-media.d.ts → voice-mic.d.ts} +0 -0
- /package/dist/{voice-helpers.d.ts → voice-remote.d.ts} +0 -0
package/dist/voice.js
CHANGED
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
import { bindAbort, createListeners, reportAsyncError } from './listeners.js';
|
|
2
2
|
import { getRoomRemoteStreams, isRoomClosed, onRoomClose } from './room.js';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
const gestureEvents = ['pointerdown', 'pointerup', 'touchend', 'click', 'keydown'];
|
|
6
|
-
const captureOpts = { capture: true };
|
|
7
|
-
const maxRemoteStreamsPerPeer = 4;
|
|
8
|
-
const maxPeerAudioPrefs = 128;
|
|
3
|
+
import { createLocalMic, defaultAudioConstraints, normalizeDeviceIdArg } from './voice-mic.js';
|
|
4
|
+
import { createRemoteAudio } from './voice-remote.js';
|
|
9
5
|
const minSpeakingIntervalMs = 50;
|
|
10
6
|
const maxSpeakingIntervalMs = 60_000;
|
|
11
7
|
const defaultSpeakingThreshold = 0.03;
|
|
@@ -201,60 +197,22 @@ export function createVoice(room, options) {
|
|
|
201
197
|
}
|
|
202
198
|
}
|
|
203
199
|
}
|
|
204
|
-
let volume = initialVolume;
|
|
205
|
-
let deafened = Boolean(options?.deafened);
|
|
206
|
-
let micStatus = 'off';
|
|
207
|
-
let micError = null;
|
|
208
|
-
let autoplayBlocked = false;
|
|
209
|
-
let selfSpeaking = false;
|
|
210
200
|
let closed = false;
|
|
211
|
-
let localStream = null;
|
|
212
|
-
let localMeter = null;
|
|
213
|
-
let localTrackCleanups = [];
|
|
214
|
-
let micEpoch = 0;
|
|
215
|
-
let switchEpoch = 0;
|
|
216
|
-
let inFlightMic = null;
|
|
217
|
-
let swapQueue = Promise.resolve();
|
|
218
|
-
let audioSessionSwitched = false;
|
|
219
|
-
let prevAudioSessionType = null;
|
|
220
|
-
let meterTimer;
|
|
221
|
-
let gestureListenersAttached = false;
|
|
222
|
-
let visibilityListenerAttached = false;
|
|
223
|
-
const remotePeers = new Map();
|
|
224
|
-
const speakingPeers = new Set();
|
|
225
|
-
const peerVolumes = new Map();
|
|
226
|
-
const mutedPeers = new Set();
|
|
227
201
|
const changes = createListeners();
|
|
228
|
-
const meter = createVoiceMeter({
|
|
229
|
-
enabled: speakingDetection,
|
|
230
|
-
threshold: speakingThreshold,
|
|
231
|
-
isClosed: () => closed,
|
|
232
|
-
onContextPaused: attachGestureListeners,
|
|
233
|
-
onContextRunning: reconcileUnlockState
|
|
234
|
-
});
|
|
235
|
-
const buildConstraints = (deviceOverride, exact) => buildAudioConstraints(baseConstraints, deviceOverride, exact);
|
|
236
|
-
function effectiveVolumeFor(peerId) {
|
|
237
|
-
return Math.max(0, Math.min(1, volume * (peerVolumes.get(peerId) ?? 1)));
|
|
238
|
-
}
|
|
239
|
-
function effectiveMutedFor(peerId) {
|
|
240
|
-
return deafened || mutedPeers.has(peerId);
|
|
241
|
-
}
|
|
242
|
-
function buildPeerVolumes() {
|
|
243
|
-
return Object.freeze(Object.fromEntries(peerVolumes));
|
|
244
|
-
}
|
|
245
202
|
function buildSnapshot() {
|
|
246
203
|
return Object.freeze({
|
|
247
|
-
micStatus,
|
|
248
|
-
micError,
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
204
|
+
micStatus: mic.status,
|
|
205
|
+
micError: mic.error,
|
|
206
|
+
micStopReason: mic.stopReason,
|
|
207
|
+
deviceId: mic.deviceId,
|
|
208
|
+
autoplayBlocked: remote.autoplayBlocked,
|
|
209
|
+
deafened: remote.deafened,
|
|
210
|
+
volume: remote.volume,
|
|
211
|
+
selfSpeaking: remote.selfSpeaking,
|
|
212
|
+
remotePeers: remote.remotePeers,
|
|
213
|
+
speakingPeers: remote.speakingPeers,
|
|
214
|
+
mutedPeers: remote.mutedPeers,
|
|
215
|
+
peerVolumes: remote.peerVolumes
|
|
258
216
|
});
|
|
259
217
|
}
|
|
260
218
|
function emitChange() {
|
|
@@ -262,806 +220,103 @@ export function createVoice(room, options) {
|
|
|
262
220
|
return;
|
|
263
221
|
changes.fire(buildSnapshot());
|
|
264
222
|
}
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
if (session.type === 'play-and-record') {
|
|
291
|
-
audioSessionSwitched = true;
|
|
292
|
-
prevAudioSessionType = prev;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
catch {
|
|
296
|
-
// Ignore unsupported audioSession writes.
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
function hasBlockedRemoteAudio() {
|
|
300
|
-
for (const streams of remotePeers.values()) {
|
|
301
|
-
for (const entry of streams.values()) {
|
|
302
|
-
if (entry.blocked || entry.audio.paused)
|
|
303
|
-
return true;
|
|
304
|
-
}
|
|
305
|
-
}
|
|
306
|
-
return false;
|
|
307
|
-
}
|
|
308
|
-
function attachGestureListeners() {
|
|
309
|
-
if (!autoUnlock || closed || gestureListenersAttached || typeof window === 'undefined')
|
|
310
|
-
return;
|
|
311
|
-
gestureListenersAttached = true;
|
|
312
|
-
for (const type of gestureEvents) {
|
|
313
|
-
window.addEventListener(type, unlockAudio, captureOpts);
|
|
314
|
-
}
|
|
315
|
-
}
|
|
316
|
-
function detachGestureListeners() {
|
|
317
|
-
if (!gestureListenersAttached || typeof window === 'undefined')
|
|
318
|
-
return;
|
|
319
|
-
gestureListenersAttached = false;
|
|
320
|
-
for (const type of gestureEvents) {
|
|
321
|
-
window.removeEventListener(type, unlockAudio, captureOpts);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
function markAutoplayBlocked() {
|
|
325
|
-
if (closed)
|
|
326
|
-
return;
|
|
327
|
-
const changed = !autoplayBlocked;
|
|
328
|
-
autoplayBlocked = true;
|
|
329
|
-
attachGestureListeners();
|
|
330
|
-
if (changed)
|
|
331
|
-
emitChange();
|
|
332
|
-
}
|
|
333
|
-
function reconcileUnlockState() {
|
|
334
|
-
if (closed)
|
|
335
|
-
return;
|
|
336
|
-
let changed = false;
|
|
337
|
-
if (autoplayBlocked && !hasBlockedRemoteAudio()) {
|
|
338
|
-
autoplayBlocked = false;
|
|
339
|
-
changed = true;
|
|
340
|
-
}
|
|
341
|
-
if (!autoplayBlocked && !meter.isPaused()) {
|
|
342
|
-
detachGestureListeners();
|
|
343
|
-
}
|
|
344
|
-
if (changed)
|
|
345
|
-
emitChange();
|
|
346
|
-
}
|
|
347
|
-
function tryPlayEntry(peerId, streamId, entry) {
|
|
348
|
-
let playPromise;
|
|
349
|
-
try {
|
|
350
|
-
playPromise = entry.audio.play();
|
|
351
|
-
}
|
|
352
|
-
catch {
|
|
353
|
-
return;
|
|
354
|
-
}
|
|
355
|
-
if (!playPromise || typeof playPromise.then !== 'function')
|
|
356
|
-
return;
|
|
357
|
-
void playPromise
|
|
358
|
-
.then(() => {
|
|
359
|
-
if (closed || remotePeers.get(peerId)?.get(streamId) !== entry)
|
|
360
|
-
return;
|
|
361
|
-
entry.blocked = false;
|
|
362
|
-
reconcileUnlockState();
|
|
363
|
-
})
|
|
364
|
-
.catch((err) => {
|
|
365
|
-
if (closed || remotePeers.get(peerId)?.get(streamId) !== entry)
|
|
366
|
-
return;
|
|
367
|
-
const name = err && typeof err === 'object' && 'name' in err
|
|
368
|
-
? String(err.name)
|
|
369
|
-
: '';
|
|
370
|
-
if (name !== 'NotAllowedError')
|
|
371
|
-
return;
|
|
372
|
-
entry.blocked = true;
|
|
373
|
-
markAutoplayBlocked();
|
|
374
|
-
});
|
|
375
|
-
}
|
|
376
|
-
// Never gate on an in-flight boolean or await audioCtx.resume(): on iOS Safari,
|
|
377
|
-
// pointerdown is not a media activation gesture and leaves audioCtx.resume()
|
|
378
|
-
// pending forever until a subsequent touchend/pointerup/click calls resume() again.
|
|
379
|
-
function unlockRemoteAudio(reattachOnPausedCtx = false) {
|
|
380
|
-
if (closed)
|
|
381
|
-
return;
|
|
382
|
-
if (meter.isPaused()) {
|
|
383
|
-
meter.resume(reconcileUnlockState);
|
|
384
|
-
if (reattachOnPausedCtx)
|
|
385
|
-
attachGestureListeners();
|
|
386
|
-
}
|
|
387
|
-
let attemptedPlay = false;
|
|
388
|
-
for (const [peerId, streams] of remotePeers) {
|
|
389
|
-
for (const [streamId, entry] of streams) {
|
|
390
|
-
if (entry.audio.paused) {
|
|
391
|
-
attemptedPlay = true;
|
|
392
|
-
tryPlayEntry(peerId, streamId, entry);
|
|
393
|
-
}
|
|
394
|
-
}
|
|
395
|
-
}
|
|
396
|
-
if (!attemptedPlay && !reattachOnPausedCtx) {
|
|
397
|
-
reconcileUnlockState();
|
|
398
|
-
}
|
|
399
|
-
}
|
|
400
|
-
function unlockAudio() {
|
|
401
|
-
unlockRemoteAudio(false);
|
|
402
|
-
}
|
|
403
|
-
function ensureMeter() {
|
|
404
|
-
if (!speakingDetection || closed || meterTimer !== undefined)
|
|
405
|
-
return;
|
|
406
|
-
if (remotePeers.size === 0 && !localMeter)
|
|
407
|
-
return;
|
|
408
|
-
meterTimer = setInterval(() => {
|
|
409
|
-
if (closed)
|
|
410
|
-
return;
|
|
411
|
-
let changed = false;
|
|
412
|
-
for (const [peerId, streams] of remotePeers) {
|
|
413
|
-
let active = false;
|
|
414
|
-
for (const entry of streams.values()) {
|
|
415
|
-
if (meter.isActive(entry)) {
|
|
416
|
-
active = true;
|
|
417
|
-
break;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
const was = speakingPeers.has(peerId);
|
|
421
|
-
if (active && !was) {
|
|
422
|
-
speakingPeers.add(peerId);
|
|
423
|
-
changed = true;
|
|
424
|
-
}
|
|
425
|
-
else if (!active && was) {
|
|
426
|
-
speakingPeers.delete(peerId);
|
|
427
|
-
changed = true;
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
const nextSelf = micStatus === 'live' && meter.isActive(localMeter);
|
|
431
|
-
if (nextSelf !== selfSpeaking) {
|
|
432
|
-
selfSpeaking = nextSelf;
|
|
433
|
-
changed = true;
|
|
434
|
-
}
|
|
435
|
-
if (changed)
|
|
436
|
-
emitChange();
|
|
437
|
-
}, speakingIntervalMs);
|
|
438
|
-
}
|
|
439
|
-
function stopMeterIfEmpty() {
|
|
440
|
-
if (remotePeers.size === 0) {
|
|
441
|
-
speakingPeers.clear();
|
|
442
|
-
autoplayBlocked = false;
|
|
443
|
-
if (!meter.isPaused()) {
|
|
444
|
-
detachGestureListeners();
|
|
445
|
-
}
|
|
446
|
-
}
|
|
447
|
-
if (remotePeers.size > 0 || localMeter)
|
|
448
|
-
return;
|
|
449
|
-
if (meterTimer !== undefined) {
|
|
450
|
-
clearInterval(meterTimer);
|
|
451
|
-
meterTimer = undefined;
|
|
452
|
-
}
|
|
453
|
-
meter.closeContext();
|
|
454
|
-
detachGestureListeners();
|
|
455
|
-
}
|
|
456
|
-
function teardownLocalStream(detachFromRoom) {
|
|
457
|
-
let changed = false;
|
|
458
|
-
for (const cleanup of localTrackCleanups)
|
|
459
|
-
cleanup();
|
|
460
|
-
localTrackCleanups = [];
|
|
461
|
-
if (localMeter) {
|
|
462
|
-
meter.disconnect(localMeter);
|
|
463
|
-
localMeter = null;
|
|
464
|
-
}
|
|
465
|
-
if (selfSpeaking) {
|
|
466
|
-
selfSpeaking = false;
|
|
467
|
-
changed = true;
|
|
468
|
-
}
|
|
469
|
-
if (localStream) {
|
|
470
|
-
const stream = localStream;
|
|
471
|
-
localStream = null;
|
|
472
|
-
if (detachFromRoom && !isRoomClosed(room)) {
|
|
473
|
-
try {
|
|
474
|
-
room.removeStream(stream, targetPeer);
|
|
475
|
-
}
|
|
476
|
-
catch {
|
|
477
|
-
// Ignore if room closed concurrently.
|
|
478
|
-
}
|
|
479
|
-
}
|
|
480
|
-
for (const track of stream.getTracks())
|
|
481
|
-
track.stop();
|
|
482
|
-
changed = true;
|
|
483
|
-
}
|
|
484
|
-
if (micStatus !== 'off') {
|
|
485
|
-
micStatus = 'off';
|
|
486
|
-
changed = true;
|
|
487
|
-
}
|
|
488
|
-
if (micError !== null) {
|
|
489
|
-
micError = null;
|
|
490
|
-
changed = true;
|
|
491
|
-
}
|
|
492
|
-
restoreAudioSession();
|
|
493
|
-
stopMeterIfEmpty();
|
|
494
|
-
return changed;
|
|
495
|
-
}
|
|
496
|
-
function bindLocalTrackEnded(stream) {
|
|
497
|
-
for (const cleanup of localTrackCleanups)
|
|
498
|
-
cleanup();
|
|
499
|
-
localTrackCleanups = [];
|
|
500
|
-
const onTrackEnded = () => {
|
|
501
|
-
if (closed || localStream !== stream)
|
|
502
|
-
return;
|
|
503
|
-
const changed = teardownLocalStream(true);
|
|
504
|
-
if (changed)
|
|
505
|
-
emitChange();
|
|
506
|
-
};
|
|
507
|
-
for (const track of stream.getAudioTracks()) {
|
|
508
|
-
track.addEventListener('ended', onTrackEnded, { once: true });
|
|
509
|
-
localTrackCleanups.push(() => track.removeEventListener('ended', onTrackEnded));
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
function failMic(error) {
|
|
513
|
-
restoreAudioSession();
|
|
514
|
-
micStatus = 'error';
|
|
515
|
-
micError = error;
|
|
516
|
-
emitChange();
|
|
517
|
-
return 'error';
|
|
518
|
-
}
|
|
519
|
-
function applySoftMute(muted) {
|
|
520
|
-
if (closed || !localStream)
|
|
521
|
-
return;
|
|
522
|
-
const next = Boolean(muted);
|
|
523
|
-
const nextStatus = next ? 'muted' : 'live';
|
|
524
|
-
if (micStatus === nextStatus)
|
|
525
|
-
return;
|
|
526
|
-
for (const track of localStream.getAudioTracks()) {
|
|
527
|
-
track.enabled = !next;
|
|
528
|
-
}
|
|
529
|
-
micStatus = nextStatus;
|
|
530
|
-
micError = null;
|
|
531
|
-
if (next)
|
|
532
|
-
selfSpeaking = false;
|
|
533
|
-
emitChange();
|
|
534
|
-
}
|
|
535
|
-
function acquireMic() {
|
|
536
|
-
if (closed)
|
|
537
|
-
return Promise.resolve('off');
|
|
538
|
-
if (inFlightMic)
|
|
539
|
-
return inFlightMic;
|
|
540
|
-
if (typeof navigator === 'undefined' || !navigator.mediaDevices?.getUserMedia) {
|
|
541
|
-
return Promise.resolve(failMic(Object.freeze({
|
|
542
|
-
code: 'insecure-context',
|
|
543
|
-
message: 'Microphone access requires HTTPS or localhost'
|
|
544
|
-
})));
|
|
545
|
-
}
|
|
546
|
-
const epoch = ++micEpoch;
|
|
547
|
-
const requestedDeviceId = selectedDeviceId;
|
|
548
|
-
const requestedDeviceExact = selectedDeviceExact;
|
|
549
|
-
micStatus = 'requesting';
|
|
550
|
-
micError = null;
|
|
551
|
-
emitChange();
|
|
552
|
-
if (closed || epoch !== micEpoch)
|
|
553
|
-
return Promise.resolve('off');
|
|
554
|
-
switchAudioSessionForMic();
|
|
555
|
-
const promise = (async () => {
|
|
556
|
-
let stream;
|
|
557
|
-
let fellBackToDefault = false;
|
|
558
|
-
try {
|
|
559
|
-
stream = await navigator.mediaDevices.getUserMedia({
|
|
560
|
-
audio: buildConstraints(requestedDeviceId, requestedDeviceExact)
|
|
561
|
-
});
|
|
562
|
-
}
|
|
563
|
-
catch (err) {
|
|
564
|
-
if (closed || epoch !== micEpoch)
|
|
565
|
-
return 'off';
|
|
566
|
-
const classified = classifyMicError(err);
|
|
567
|
-
if (fallbackToDefaultOnNotFound &&
|
|
568
|
-
requestedDeviceId !== null &&
|
|
569
|
-
classified.code === 'not-found') {
|
|
570
|
-
try {
|
|
571
|
-
stream = await navigator.mediaDevices.getUserMedia({
|
|
572
|
-
audio: buildConstraints(null, false)
|
|
573
|
-
});
|
|
574
|
-
fellBackToDefault = true;
|
|
575
|
-
}
|
|
576
|
-
catch (fallbackErr) {
|
|
577
|
-
if (closed || epoch !== micEpoch)
|
|
578
|
-
return 'off';
|
|
579
|
-
return failMic(classifyMicError(fallbackErr));
|
|
580
|
-
}
|
|
581
|
-
}
|
|
582
|
-
else {
|
|
583
|
-
return failMic(classified);
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
if (closed || epoch !== micEpoch || isRoomClosed(room)) {
|
|
587
|
-
for (const track of stream.getTracks())
|
|
588
|
-
track.stop();
|
|
589
|
-
if (!closed && epoch === micEpoch) {
|
|
590
|
-
return failMic(Object.freeze({ code: 'room-closed', message: 'Room is closed' }));
|
|
591
|
-
}
|
|
592
|
-
return 'off';
|
|
593
|
-
}
|
|
594
|
-
try {
|
|
595
|
-
room.addStream(stream, {
|
|
596
|
-
...(targetPeer !== undefined ? { to: targetPeer } : {}),
|
|
597
|
-
tag: streamTag
|
|
598
|
-
});
|
|
599
|
-
}
|
|
600
|
-
catch {
|
|
601
|
-
for (const track of stream.getTracks())
|
|
602
|
-
track.stop();
|
|
603
|
-
return failMic(Object.freeze({ code: 'room-closed', message: 'Room is closed' }));
|
|
604
|
-
}
|
|
605
|
-
localStream = stream;
|
|
606
|
-
const actualDeviceId = stream.getAudioTracks()[0]?.getSettings?.().deviceId;
|
|
607
|
-
const resolvedActual = typeof actualDeviceId === 'string' && actualDeviceId.length > 0 ? actualDeviceId : null;
|
|
608
|
-
if (fellBackToDefault) {
|
|
609
|
-
selectedDeviceId = resolvedActual;
|
|
610
|
-
selectedDeviceExact = false;
|
|
611
|
-
}
|
|
612
|
-
else {
|
|
613
|
-
selectedDeviceId = requestedDeviceId ?? resolvedActual;
|
|
614
|
-
}
|
|
615
|
-
micStatus = 'live';
|
|
616
|
-
micError = null;
|
|
617
|
-
bindLocalTrackEnded(stream);
|
|
618
|
-
const m = meter.createAnalyser(stream);
|
|
619
|
-
localMeter = m.analyser ? m : null;
|
|
620
|
-
ensureMeter();
|
|
621
|
-
unlockAudio();
|
|
622
|
-
emitChange();
|
|
623
|
-
return 'live';
|
|
624
|
-
})();
|
|
625
|
-
inFlightMic = promise;
|
|
626
|
-
void promise.finally(() => {
|
|
627
|
-
if (inFlightMic === promise) {
|
|
628
|
-
inFlightMic = null;
|
|
629
|
-
}
|
|
630
|
-
});
|
|
631
|
-
return promise;
|
|
632
|
-
}
|
|
633
|
-
function teardownRemoteEntry(entry) {
|
|
634
|
-
meter.disconnect(entry);
|
|
635
|
-
try {
|
|
636
|
-
entry.audio.pause();
|
|
637
|
-
}
|
|
638
|
-
catch {
|
|
639
|
-
// Ignore non-standard audio element implementations.
|
|
640
|
-
}
|
|
641
|
-
entry.audio.srcObject = null;
|
|
642
|
-
entry.audio.remove();
|
|
643
|
-
}
|
|
644
|
-
function addRemoteStream(peerId, stream, meta) {
|
|
645
|
-
if (closed || typeof document === 'undefined' || !document.body)
|
|
646
|
-
return;
|
|
647
|
-
if (!stream || typeof stream.getAudioTracks !== 'function')
|
|
648
|
-
return;
|
|
649
|
-
if (stream.getAudioTracks().length === 0)
|
|
650
|
-
return;
|
|
651
|
-
const incomingTag = meta?.tag;
|
|
652
|
-
if (incomingTag === undefined ? strictStreamTag : incomingTag !== streamTag)
|
|
653
|
-
return;
|
|
654
|
-
let byPeer = remotePeers.get(peerId);
|
|
655
|
-
if (!byPeer) {
|
|
656
|
-
byPeer = new Map();
|
|
657
|
-
remotePeers.set(peerId, byPeer);
|
|
658
|
-
}
|
|
659
|
-
if (byPeer.has(stream.id))
|
|
660
|
-
return;
|
|
661
|
-
if (byPeer.size >= maxRemoteStreamsPerPeer)
|
|
662
|
-
return;
|
|
663
|
-
const audio = document.createElement('audio');
|
|
664
|
-
audio.autoplay = true;
|
|
665
|
-
audio.setAttribute('playsinline', '');
|
|
666
|
-
audio.hidden = true;
|
|
667
|
-
audio.muted = effectiveMutedFor(peerId);
|
|
668
|
-
applyAudioVolume(audio, effectiveVolumeFor(peerId));
|
|
669
|
-
audio.srcObject = stream;
|
|
670
|
-
document.body.append(audio);
|
|
671
|
-
const m = meter.createAnalyser(stream);
|
|
672
|
-
const entry = { audio, blocked: false, ...m };
|
|
673
|
-
byPeer.set(stream.id, entry);
|
|
674
|
-
const onPlaybackAccepted = () => {
|
|
675
|
-
if (closed || remotePeers.get(peerId)?.get(stream.id) !== entry || entry.audio.paused)
|
|
676
|
-
return;
|
|
677
|
-
entry.blocked = false;
|
|
678
|
-
reconcileUnlockState();
|
|
679
|
-
};
|
|
680
|
-
audio.addEventListener('play', onPlaybackAccepted);
|
|
681
|
-
audio.addEventListener('playing', onPlaybackAccepted);
|
|
682
|
-
tryPlayEntry(peerId, stream.id, entry);
|
|
683
|
-
ensureMeter();
|
|
684
|
-
emitChange();
|
|
685
|
-
}
|
|
686
|
-
function removeRemoteStream(peerId, stream) {
|
|
687
|
-
if (closed)
|
|
688
|
-
return;
|
|
689
|
-
const byPeer = remotePeers.get(peerId);
|
|
690
|
-
const entry = byPeer?.get(stream.id);
|
|
691
|
-
if (!entry || !byPeer)
|
|
692
|
-
return;
|
|
693
|
-
teardownRemoteEntry(entry);
|
|
694
|
-
byPeer.delete(stream.id);
|
|
695
|
-
if (byPeer.size === 0) {
|
|
696
|
-
remotePeers.delete(peerId);
|
|
697
|
-
speakingPeers.delete(peerId);
|
|
698
|
-
}
|
|
699
|
-
stopMeterIfEmpty();
|
|
700
|
-
reconcileUnlockState();
|
|
701
|
-
emitChange();
|
|
702
|
-
}
|
|
703
|
-
const onVisibilityChange = () => {
|
|
704
|
-
if (closed || typeof document === 'undefined' || document.visibilityState !== 'visible')
|
|
705
|
-
return;
|
|
706
|
-
unlockRemoteAudio(true);
|
|
707
|
-
};
|
|
223
|
+
const remote = createRemoteAudio({
|
|
224
|
+
initialVolume,
|
|
225
|
+
initialDeafened: Boolean(options?.deafened),
|
|
226
|
+
autoUnlock,
|
|
227
|
+
speakingDetection,
|
|
228
|
+
speakingThreshold,
|
|
229
|
+
speakingIntervalMs,
|
|
230
|
+
streamTag,
|
|
231
|
+
strictStreamTag,
|
|
232
|
+
onChange: emitChange
|
|
233
|
+
});
|
|
234
|
+
const mic = createLocalMic({
|
|
235
|
+
room,
|
|
236
|
+
baseConstraints,
|
|
237
|
+
initialDeviceId: selectedDeviceId,
|
|
238
|
+
initialDeviceExact: selectedDeviceExact,
|
|
239
|
+
fallbackToDefaultOnNotFound,
|
|
240
|
+
targetPeer,
|
|
241
|
+
streamTag,
|
|
242
|
+
onLocalStream: remote.setLocalStream,
|
|
243
|
+
onChange: emitChange
|
|
244
|
+
});
|
|
245
|
+
let offStream = () => { };
|
|
246
|
+
let offStreamEnd = () => { };
|
|
247
|
+
let offRoomClose = () => { };
|
|
708
248
|
function closeInternal(roomClosing) {
|
|
709
249
|
if (closed)
|
|
710
250
|
return;
|
|
711
251
|
closed = true;
|
|
712
|
-
micEpoch++;
|
|
713
|
-
switchEpoch++;
|
|
714
|
-
inFlightMic = null;
|
|
715
252
|
offStream();
|
|
716
253
|
offStreamEnd();
|
|
717
254
|
offRoomClose();
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
document.removeEventListener('visibilitychange', onVisibilityChange);
|
|
721
|
-
}
|
|
722
|
-
detachGestureListeners();
|
|
723
|
-
teardownLocalStream(!roomClosing);
|
|
724
|
-
for (const byPeer of remotePeers.values()) {
|
|
725
|
-
for (const entry of byPeer.values()) {
|
|
726
|
-
teardownRemoteEntry(entry);
|
|
727
|
-
}
|
|
728
|
-
}
|
|
729
|
-
remotePeers.clear();
|
|
730
|
-
speakingPeers.clear();
|
|
731
|
-
peerVolumes.clear();
|
|
732
|
-
mutedPeers.clear();
|
|
733
|
-
autoplayBlocked = false;
|
|
734
|
-
stopMeterIfEmpty();
|
|
255
|
+
mic.close(roomClosing);
|
|
256
|
+
remote.close();
|
|
735
257
|
changes.clear();
|
|
736
258
|
}
|
|
737
|
-
let offStream = () => { };
|
|
738
|
-
let offStreamEnd = () => { };
|
|
739
|
-
let offRoomClose = () => { };
|
|
740
259
|
if (isRoomClosed(room)) {
|
|
741
|
-
|
|
742
|
-
changes.clear();
|
|
260
|
+
closeInternal(true);
|
|
743
261
|
}
|
|
744
262
|
else {
|
|
745
|
-
offStream = room.onPeerStream(addRemoteStream);
|
|
746
|
-
offStreamEnd = room.onPeerStreamEnd(removeRemoteStream);
|
|
263
|
+
offStream = room.onPeerStream(remote.addRemoteStream);
|
|
264
|
+
offStreamEnd = room.onPeerStreamEnd(remote.removeRemoteStream);
|
|
747
265
|
offRoomClose = onRoomClose(room, () => closeInternal(true));
|
|
748
|
-
if (autoUnlock && typeof document !== 'undefined') {
|
|
749
|
-
visibilityListenerAttached = true;
|
|
750
|
-
document.addEventListener('visibilitychange', onVisibilityChange);
|
|
751
|
-
}
|
|
752
266
|
for (const [peerId, stream, meta] of getRoomRemoteStreams(room)) {
|
|
753
|
-
addRemoteStream(peerId, stream, meta);
|
|
267
|
+
remote.addRemoteStream(peerId, stream, meta);
|
|
754
268
|
}
|
|
755
269
|
}
|
|
756
270
|
return {
|
|
757
271
|
get micStatus() {
|
|
758
|
-
return
|
|
272
|
+
return mic.status;
|
|
759
273
|
},
|
|
760
274
|
get micError() {
|
|
761
|
-
return
|
|
275
|
+
return mic.error;
|
|
276
|
+
},
|
|
277
|
+
get micStopReason() {
|
|
278
|
+
return mic.stopReason;
|
|
762
279
|
},
|
|
763
280
|
get deviceId() {
|
|
764
|
-
return
|
|
281
|
+
return mic.deviceId;
|
|
765
282
|
},
|
|
766
283
|
get autoplayBlocked() {
|
|
767
|
-
return autoplayBlocked;
|
|
284
|
+
return remote.autoplayBlocked;
|
|
768
285
|
},
|
|
769
286
|
get deafened() {
|
|
770
|
-
return deafened;
|
|
287
|
+
return remote.deafened;
|
|
771
288
|
},
|
|
772
289
|
get volume() {
|
|
773
|
-
return volume;
|
|
290
|
+
return remote.volume;
|
|
774
291
|
},
|
|
775
292
|
get selfSpeaking() {
|
|
776
|
-
return selfSpeaking;
|
|
293
|
+
return remote.selfSpeaking;
|
|
777
294
|
},
|
|
778
295
|
get remotePeers() {
|
|
779
|
-
return
|
|
296
|
+
return remote.remotePeers;
|
|
780
297
|
},
|
|
781
298
|
get speakingPeers() {
|
|
782
|
-
return
|
|
299
|
+
return remote.speakingPeers;
|
|
783
300
|
},
|
|
784
301
|
get mutedPeers() {
|
|
785
|
-
return
|
|
302
|
+
return remote.mutedPeers;
|
|
786
303
|
},
|
|
787
304
|
get peerVolumes() {
|
|
788
|
-
return
|
|
305
|
+
return remote.peerVolumes;
|
|
789
306
|
},
|
|
790
307
|
getSnapshot: buildSnapshot,
|
|
791
|
-
toggleMic
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
if (closed)
|
|
804
|
-
return Promise.resolve('off');
|
|
805
|
-
if (inFlightMic)
|
|
806
|
-
return inFlightMic;
|
|
807
|
-
if (localStream) {
|
|
808
|
-
applySoftMute(false);
|
|
809
|
-
return Promise.resolve('live');
|
|
810
|
-
}
|
|
811
|
-
return acquireMic();
|
|
812
|
-
},
|
|
813
|
-
setMuted: applySoftMute,
|
|
814
|
-
stopMic() {
|
|
815
|
-
if (closed)
|
|
816
|
-
return;
|
|
817
|
-
const wasRequesting = inFlightMic !== null;
|
|
818
|
-
micEpoch++;
|
|
819
|
-
switchEpoch++;
|
|
820
|
-
inFlightMic = null;
|
|
821
|
-
const changed = teardownLocalStream(true);
|
|
822
|
-
if (changed || wasRequesting)
|
|
823
|
-
emitChange();
|
|
824
|
-
},
|
|
825
|
-
async switchDevice(deviceId) {
|
|
826
|
-
const nextDeviceId = normalizeDeviceIdArg(deviceId);
|
|
827
|
-
if (closed)
|
|
828
|
-
return 'off';
|
|
829
|
-
if (inFlightMic !== null) {
|
|
830
|
-
micEpoch++;
|
|
831
|
-
switchEpoch++;
|
|
832
|
-
inFlightMic = null;
|
|
833
|
-
selectedDeviceId = nextDeviceId;
|
|
834
|
-
selectedDeviceExact = nextDeviceId !== null;
|
|
835
|
-
return acquireMic();
|
|
836
|
-
}
|
|
837
|
-
if (!localStream || (micStatus !== 'live' && micStatus !== 'muted')) {
|
|
838
|
-
const hadError = micStatus === 'error' || micError !== null;
|
|
839
|
-
const deviceChanged = selectedDeviceId !== nextDeviceId;
|
|
840
|
-
selectedDeviceId = nextDeviceId;
|
|
841
|
-
selectedDeviceExact = nextDeviceId !== null;
|
|
842
|
-
if (hadError) {
|
|
843
|
-
micStatus = 'off';
|
|
844
|
-
micError = null;
|
|
845
|
-
}
|
|
846
|
-
if (hadError || deviceChanged) {
|
|
847
|
-
emitChange();
|
|
848
|
-
}
|
|
849
|
-
return micStatus;
|
|
850
|
-
}
|
|
851
|
-
if (typeof navigator === 'undefined' || !navigator.mediaDevices?.getUserMedia) {
|
|
852
|
-
micError = Object.freeze({
|
|
853
|
-
code: 'insecure-context',
|
|
854
|
-
message: 'Microphone access requires HTTPS or localhost'
|
|
855
|
-
});
|
|
856
|
-
emitChange();
|
|
857
|
-
return micStatus;
|
|
858
|
-
}
|
|
859
|
-
if (typeof room.replaceStreamTrack !== 'function') {
|
|
860
|
-
throw new TypeError('Room instance does not support replaceStreamTrack');
|
|
861
|
-
}
|
|
862
|
-
const epoch = micEpoch;
|
|
863
|
-
const sEpoch = ++switchEpoch;
|
|
864
|
-
const isStale = () => closed || epoch !== micEpoch || sEpoch !== switchEpoch || !localStream || isRoomClosed(room);
|
|
865
|
-
let newStream;
|
|
866
|
-
try {
|
|
867
|
-
newStream = await navigator.mediaDevices.getUserMedia({
|
|
868
|
-
audio: buildConstraints(nextDeviceId, nextDeviceId !== null)
|
|
869
|
-
});
|
|
870
|
-
}
|
|
871
|
-
catch (err) {
|
|
872
|
-
if (closed)
|
|
873
|
-
return 'off';
|
|
874
|
-
if (epoch !== micEpoch || sEpoch !== switchEpoch)
|
|
875
|
-
return micStatus;
|
|
876
|
-
micError = classifyMicError(err);
|
|
877
|
-
emitChange();
|
|
878
|
-
return micStatus;
|
|
879
|
-
}
|
|
880
|
-
if (isStale()) {
|
|
881
|
-
for (const t of newStream.getTracks())
|
|
882
|
-
t.stop();
|
|
883
|
-
return closed ? 'off' : micStatus;
|
|
884
|
-
}
|
|
885
|
-
let resultStatus = micStatus;
|
|
886
|
-
const runSwap = swapQueue.then(async () => {
|
|
887
|
-
if (isStale()) {
|
|
888
|
-
for (const t of newStream.getTracks())
|
|
889
|
-
t.stop();
|
|
890
|
-
resultStatus = closed ? 'off' : micStatus;
|
|
891
|
-
return;
|
|
892
|
-
}
|
|
893
|
-
const audioTracks = newStream.getAudioTracks();
|
|
894
|
-
const newTrack = audioTracks[0];
|
|
895
|
-
for (const extra of newStream.getTracks()) {
|
|
896
|
-
if (extra !== newTrack)
|
|
897
|
-
extra.stop();
|
|
898
|
-
}
|
|
899
|
-
const targetStream = localStream;
|
|
900
|
-
const oldTrack = targetStream.getAudioTracks()[0];
|
|
901
|
-
if (!newTrack || !oldTrack) {
|
|
902
|
-
newTrack?.stop();
|
|
903
|
-
resultStatus = micStatus;
|
|
904
|
-
return;
|
|
905
|
-
}
|
|
906
|
-
newTrack.enabled = micStatus === 'live';
|
|
907
|
-
for (const cleanup of localTrackCleanups)
|
|
908
|
-
cleanup();
|
|
909
|
-
localTrackCleanups = [];
|
|
910
|
-
try {
|
|
911
|
-
await room.replaceStreamTrack(targetStream, oldTrack, newTrack);
|
|
912
|
-
}
|
|
913
|
-
catch (err) {
|
|
914
|
-
if (!targetStream.getTracks().includes(oldTrack)) {
|
|
915
|
-
oldTrack.stop();
|
|
916
|
-
}
|
|
917
|
-
newTrack.stop();
|
|
918
|
-
if (!closed && epoch === micEpoch && localStream === targetStream) {
|
|
919
|
-
if (!targetStream.getAudioTracks().length) {
|
|
920
|
-
teardownLocalStream(true);
|
|
921
|
-
}
|
|
922
|
-
else {
|
|
923
|
-
bindLocalTrackEnded(targetStream);
|
|
924
|
-
}
|
|
925
|
-
micError = classifyMicError(err);
|
|
926
|
-
emitChange();
|
|
927
|
-
}
|
|
928
|
-
resultStatus = closed ? 'off' : micStatus;
|
|
929
|
-
return;
|
|
930
|
-
}
|
|
931
|
-
// oldTrack has been removed from targetStream; always release hardware even if cancelled mid-await.
|
|
932
|
-
oldTrack.stop();
|
|
933
|
-
if (closed || epoch !== micEpoch || localStream !== targetStream) {
|
|
934
|
-
newTrack.stop();
|
|
935
|
-
resultStatus = closed ? 'off' : micStatus;
|
|
936
|
-
return;
|
|
937
|
-
}
|
|
938
|
-
if (sEpoch !== switchEpoch) {
|
|
939
|
-
// A newer switchDevice() is queued next in swapQueue and will replace newTrack!
|
|
940
|
-
bindLocalTrackEnded(targetStream);
|
|
941
|
-
resultStatus = micStatus;
|
|
942
|
-
return;
|
|
943
|
-
}
|
|
944
|
-
bindLocalTrackEnded(targetStream);
|
|
945
|
-
if (localMeter) {
|
|
946
|
-
meter.disconnect(localMeter);
|
|
947
|
-
localMeter = null;
|
|
948
|
-
}
|
|
949
|
-
const m = meter.createAnalyser(targetStream);
|
|
950
|
-
localMeter = m.analyser ? m : null;
|
|
951
|
-
ensureMeter();
|
|
952
|
-
const actualDeviceId = newTrack.getSettings?.().deviceId;
|
|
953
|
-
selectedDeviceId =
|
|
954
|
-
nextDeviceId ??
|
|
955
|
-
(typeof actualDeviceId === 'string' && actualDeviceId.length > 0 ? actualDeviceId : null);
|
|
956
|
-
selectedDeviceExact = nextDeviceId !== null;
|
|
957
|
-
micError = null;
|
|
958
|
-
emitChange();
|
|
959
|
-
resultStatus = micStatus;
|
|
960
|
-
});
|
|
961
|
-
swapQueue = runSwap.catch(() => { });
|
|
962
|
-
await runSwap;
|
|
963
|
-
return resultStatus;
|
|
964
|
-
},
|
|
965
|
-
setVolume(nextVolume) {
|
|
966
|
-
if (typeof nextVolume !== 'number' || !Number.isFinite(nextVolume)) {
|
|
967
|
-
throw new RangeError('Expected a finite volume');
|
|
968
|
-
}
|
|
969
|
-
if (closed)
|
|
970
|
-
return;
|
|
971
|
-
const clamped = Math.max(0, Math.min(1, nextVolume));
|
|
972
|
-
if (clamped === volume)
|
|
973
|
-
return;
|
|
974
|
-
volume = clamped;
|
|
975
|
-
for (const [peerId, byPeer] of remotePeers) {
|
|
976
|
-
const eff = effectiveVolumeFor(peerId);
|
|
977
|
-
for (const entry of byPeer.values()) {
|
|
978
|
-
applyAudioVolume(entry.audio, eff);
|
|
979
|
-
}
|
|
980
|
-
}
|
|
981
|
-
emitChange();
|
|
982
|
-
},
|
|
983
|
-
setPeerVolume(peerId, nextPeerVolume) {
|
|
984
|
-
validatePeerIdArg(peerId);
|
|
985
|
-
if (typeof nextPeerVolume !== 'number' || !Number.isFinite(nextPeerVolume)) {
|
|
986
|
-
throw new RangeError('Expected a finite volume');
|
|
987
|
-
}
|
|
988
|
-
if (closed)
|
|
989
|
-
return;
|
|
990
|
-
const clamped = Math.max(0, Math.min(1, nextPeerVolume));
|
|
991
|
-
const prev = peerVolumes.get(peerId) ?? 1;
|
|
992
|
-
if (clamped === prev)
|
|
993
|
-
return;
|
|
994
|
-
if (clamped === 1) {
|
|
995
|
-
peerVolumes.delete(peerId);
|
|
996
|
-
}
|
|
997
|
-
else {
|
|
998
|
-
if (!peerVolumes.has(peerId)) {
|
|
999
|
-
evictPeerPref(peerVolumes, remotePeers, maxPeerAudioPrefs);
|
|
1000
|
-
}
|
|
1001
|
-
peerVolumes.delete(peerId);
|
|
1002
|
-
peerVolumes.set(peerId, clamped);
|
|
1003
|
-
}
|
|
1004
|
-
const byPeer = remotePeers.get(peerId);
|
|
1005
|
-
if (byPeer) {
|
|
1006
|
-
const eff = effectiveVolumeFor(peerId);
|
|
1007
|
-
for (const entry of byPeer.values()) {
|
|
1008
|
-
applyAudioVolume(entry.audio, eff);
|
|
1009
|
-
}
|
|
1010
|
-
}
|
|
1011
|
-
emitChange();
|
|
1012
|
-
},
|
|
1013
|
-
getPeerVolume(peerId) {
|
|
1014
|
-
if (typeof peerId !== 'string' || peerId.length === 0)
|
|
1015
|
-
return 1;
|
|
1016
|
-
return peerVolumes.get(peerId) ?? 1;
|
|
1017
|
-
},
|
|
1018
|
-
setDeafened(nextDeafened) {
|
|
1019
|
-
if (closed)
|
|
1020
|
-
return;
|
|
1021
|
-
const next = Boolean(nextDeafened);
|
|
1022
|
-
if (next === deafened)
|
|
1023
|
-
return;
|
|
1024
|
-
deafened = next;
|
|
1025
|
-
for (const [peerId, byPeer] of remotePeers) {
|
|
1026
|
-
const effMuted = effectiveMutedFor(peerId);
|
|
1027
|
-
for (const entry of byPeer.values()) {
|
|
1028
|
-
entry.audio.muted = effMuted;
|
|
1029
|
-
}
|
|
1030
|
-
}
|
|
1031
|
-
if (!next)
|
|
1032
|
-
unlockAudio();
|
|
1033
|
-
emitChange();
|
|
1034
|
-
},
|
|
1035
|
-
setPeerMuted(peerId, muted) {
|
|
1036
|
-
validatePeerIdArg(peerId);
|
|
1037
|
-
if (closed)
|
|
1038
|
-
return;
|
|
1039
|
-
const next = Boolean(muted);
|
|
1040
|
-
const was = mutedPeers.has(peerId);
|
|
1041
|
-
if (next === was)
|
|
1042
|
-
return;
|
|
1043
|
-
if (next) {
|
|
1044
|
-
evictPeerPref(mutedPeers, remotePeers, maxPeerAudioPrefs);
|
|
1045
|
-
mutedPeers.add(peerId);
|
|
1046
|
-
}
|
|
1047
|
-
else {
|
|
1048
|
-
mutedPeers.delete(peerId);
|
|
1049
|
-
}
|
|
1050
|
-
const byPeer = remotePeers.get(peerId);
|
|
1051
|
-
if (byPeer) {
|
|
1052
|
-
const effMuted = effectiveMutedFor(peerId);
|
|
1053
|
-
for (const entry of byPeer.values()) {
|
|
1054
|
-
entry.audio.muted = effMuted;
|
|
1055
|
-
}
|
|
1056
|
-
}
|
|
1057
|
-
if (!next && !deafened)
|
|
1058
|
-
unlockAudio();
|
|
1059
|
-
emitChange();
|
|
1060
|
-
},
|
|
1061
|
-
isPeerMuted(peerId) {
|
|
1062
|
-
return typeof peerId === 'string' && mutedPeers.has(peerId);
|
|
1063
|
-
},
|
|
1064
|
-
unlockAudio,
|
|
308
|
+
toggleMic: mic.toggleMic,
|
|
309
|
+
startMic: mic.startMic,
|
|
310
|
+
setMuted: mic.setMuted,
|
|
311
|
+
stopMic: mic.stopMic,
|
|
312
|
+
switchDevice: mic.switchDevice,
|
|
313
|
+
setVolume: remote.setVolume,
|
|
314
|
+
setPeerVolume: remote.setPeerVolume,
|
|
315
|
+
getPeerVolume: remote.getPeerVolume,
|
|
316
|
+
setDeafened: remote.setDeafened,
|
|
317
|
+
setPeerMuted: remote.setPeerMuted,
|
|
318
|
+
isPeerMuted: remote.isPeerMuted,
|
|
319
|
+
unlockAudio: remote.unlockAudio,
|
|
1065
320
|
onChange(fn, listenOpts) {
|
|
1066
321
|
return changes.add(fn, listenOpts);
|
|
1067
322
|
},
|