@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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/room/track/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,KAAK,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACpG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,mBAAmB,CACjC,OAAO,CAAC,EAAE,wBAAwB,EAClC,aAAa,CAAC,EAAE,mBAAmB,EACnC,aAAa,CAAC,EAAE,mBAAmB,GAClC,wBAAwB,CAqB1B;AAYD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,wBAAwB,GAAG,sBAAsB,CAqC/F;AACD;;;GAGG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,SAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAkBzF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,YAAY,GAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/room/track/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,OAAO,KAAK,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AACpG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C,wBAAgB,mBAAmB,CACjC,OAAO,CAAC,EAAE,wBAAwB,EAClC,aAAa,CAAC,EAAE,mBAAmB,EACnC,aAAa,CAAC,EAAE,mBAAmB,GAClC,wBAAwB,CAqB1B;AAYD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,wBAAwB,GAAG,sBAAsB,CAqC/F;AACD;;;GAGG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,UAAU,EAAE,UAAU,SAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAkBzF;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,YAAY,GAAG,IAAI,CAmCxD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,eAAe,wEAQjD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,GAAG,eAAe,GAAG,SAAS,CAQ9E"}
|
package/package.json
CHANGED
package/src/room/track/utils.ts
CHANGED
|
@@ -110,7 +110,35 @@ export function getNewAudioContext(): AudioContext | void {
|
|
|
110
110
|
// @ts-ignore
|
|
111
111
|
typeof window !== 'undefined' && (window.AudioContext || window.webkitAudioContext);
|
|
112
112
|
if (AudioContext) {
|
|
113
|
-
|
|
113
|
+
const audioContext = new AudioContext({ latencyHint: 'interactive' });
|
|
114
|
+
// If the audio context is suspended, we need to resume it when the user clicks on the page
|
|
115
|
+
if (
|
|
116
|
+
audioContext.state === 'suspended' &&
|
|
117
|
+
typeof window !== 'undefined' &&
|
|
118
|
+
window.document?.body
|
|
119
|
+
) {
|
|
120
|
+
const handleResume = async () => {
|
|
121
|
+
try {
|
|
122
|
+
if (audioContext.state === 'suspended') {
|
|
123
|
+
await audioContext.resume();
|
|
124
|
+
}
|
|
125
|
+
} catch (e) {
|
|
126
|
+
console.warn('Error trying to auto-resume audio context', e);
|
|
127
|
+
} finally {
|
|
128
|
+
window.document.body?.removeEventListener('click', handleResume);
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
|
|
132
|
+
// https://developer.mozilla.org/en-US/docs/Web/API/BaseAudioContext/statechange_event
|
|
133
|
+
audioContext.addEventListener('statechange', () => {
|
|
134
|
+
if (audioContext.state === 'closed') {
|
|
135
|
+
window.document.body?.removeEventListener('click', handleResume);
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
window.document.body.addEventListener('click', handleResume);
|
|
140
|
+
}
|
|
141
|
+
return audioContext;
|
|
114
142
|
}
|
|
115
143
|
}
|
|
116
144
|
|