@dtelecom/livekit-client 1.12.17 → 1.12.19
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/livekit-client.esm.mjs +30 -5
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.umd.js +1 -1
- package/dist/livekit-client.umd.js.map +1 -1
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/track/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/room/Room.ts +6 -4
- package/src/room/track/utils.ts +29 -1
|
@@ -14198,7 +14198,7 @@ function getMatch(exp, ua) {
|
|
|
14198
14198
|
return match && match.length >= id && match[id] || '';
|
|
14199
14199
|
}
|
|
14200
14200
|
|
|
14201
|
-
var version$1 = "1.12.
|
|
14201
|
+
var version$1 = "1.12.19";
|
|
14202
14202
|
|
|
14203
14203
|
const version = version$1;
|
|
14204
14204
|
const protocolVersion = 9;
|
|
@@ -15186,13 +15186,38 @@ function detectSilence(track) {
|
|
|
15186
15186
|
* @internal
|
|
15187
15187
|
*/
|
|
15188
15188
|
function getNewAudioContext() {
|
|
15189
|
+
var _a;
|
|
15189
15190
|
const AudioContext =
|
|
15190
15191
|
// @ts-ignore
|
|
15191
15192
|
typeof window !== 'undefined' && (window.AudioContext || window.webkitAudioContext);
|
|
15192
15193
|
if (AudioContext) {
|
|
15193
|
-
|
|
15194
|
+
const audioContext = new AudioContext({
|
|
15194
15195
|
latencyHint: 'interactive'
|
|
15195
15196
|
});
|
|
15197
|
+
// If the audio context is suspended, we need to resume it when the user clicks on the page
|
|
15198
|
+
if (audioContext.state === 'suspended' && typeof window !== 'undefined' && ((_a = window.document) === null || _a === void 0 ? void 0 : _a.body)) {
|
|
15199
|
+
const handleResume = () => __awaiter(this, void 0, void 0, function* () {
|
|
15200
|
+
var _b;
|
|
15201
|
+
try {
|
|
15202
|
+
if (audioContext.state === 'suspended') {
|
|
15203
|
+
yield audioContext.resume();
|
|
15204
|
+
}
|
|
15205
|
+
} catch (e) {
|
|
15206
|
+
console.warn('Error trying to auto-resume audio context', e);
|
|
15207
|
+
} finally {
|
|
15208
|
+
(_b = window.document.body) === null || _b === void 0 ? void 0 : _b.removeEventListener('click', handleResume);
|
|
15209
|
+
}
|
|
15210
|
+
});
|
|
15211
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/statechange_event
|
|
15212
|
+
audioContext.addEventListener('statechange', () => {
|
|
15213
|
+
var _a;
|
|
15214
|
+
if (audioContext.state === 'closed') {
|
|
15215
|
+
(_a = window.document.body) === null || _a === void 0 ? void 0 : _a.removeEventListener('click', handleResume);
|
|
15216
|
+
}
|
|
15217
|
+
});
|
|
15218
|
+
window.document.body.addEventListener('click', handleResume);
|
|
15219
|
+
}
|
|
15220
|
+
return audioContext;
|
|
15196
15221
|
}
|
|
15197
15222
|
}
|
|
15198
15223
|
/**
|
|
@@ -23758,10 +23783,10 @@ class Room extends EventEmitter {
|
|
|
23758
23783
|
});
|
|
23759
23784
|
});
|
|
23760
23785
|
try {
|
|
23761
|
-
yield Promise.all(elements.map(e => {
|
|
23786
|
+
yield Promise.all([this.acquireAudioContext(), ...elements.map(e => {
|
|
23762
23787
|
e.muted = false;
|
|
23763
23788
|
return e.play();
|
|
23764
|
-
}));
|
|
23789
|
+
})]);
|
|
23765
23790
|
this.handleAudioPlaybackStarted();
|
|
23766
23791
|
} catch (err) {
|
|
23767
23792
|
this.handleAudioPlaybackFailed(err);
|
|
@@ -23993,7 +24018,7 @@ class Room extends EventEmitter {
|
|
|
23993
24018
|
// for iOS a newly created AudioContext is always in `suspended` state.
|
|
23994
24019
|
// we try our best to resume the context here, if that doesn't work, we just continue with regular processing
|
|
23995
24020
|
try {
|
|
23996
|
-
yield this.audioContext.resume();
|
|
24021
|
+
yield Promise.race([this.audioContext.resume(), sleep(200)]);
|
|
23997
24022
|
} catch (e) {
|
|
23998
24023
|
livekitLogger.warn(e);
|
|
23999
24024
|
}
|