@dtelecom/livekit-client 1.12.17 → 1.12.18

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.
@@ -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.17";
14201
+ var version$1 = "1.12.18";
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
- return new AudioContext({
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
  /**