@vkontakte/calls-sdk 2.8.12-dev.fd0aff08.0 → 2.8.12
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/calls-sdk.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @vkontakte/calls-sdk v2.8.12
|
|
3
|
-
*
|
|
2
|
+
* @vkontakte/calls-sdk v2.8.12
|
|
3
|
+
* Wed, 09 Sep 2026 10:07:50 GMT
|
|
4
4
|
* https://calls-sdk.cdn-vk.ru/doc/latest/index.html
|
|
5
5
|
*/
|
|
6
6
|
|
|
@@ -2155,7 +2155,7 @@ var yn = vn.getInstance(), M = class e {
|
|
|
2155
2155
|
return 1.1;
|
|
2156
2156
|
}
|
|
2157
2157
|
static get sdkVersion() {
|
|
2158
|
-
return "2.8.12
|
|
2158
|
+
return "2.8.12";
|
|
2159
2159
|
}
|
|
2160
2160
|
static get debug() {
|
|
2161
2161
|
return e._params.debug;
|
|
@@ -2700,7 +2700,7 @@ h(M, "_params", {
|
|
|
2700
2700
|
waitForRecordResponse: !1,
|
|
2701
2701
|
transparentAudio: !1,
|
|
2702
2702
|
enableSessionStateUpdates: !1,
|
|
2703
|
-
safariAudioElement: !
|
|
2703
|
+
safariAudioElement: !0,
|
|
2704
2704
|
forwardEmptyIceCandidate: !1
|
|
2705
2705
|
});
|
|
2706
2706
|
//#endregion
|
|
@@ -4916,7 +4916,7 @@ var Qr = class {
|
|
|
4916
4916
|
}
|
|
4917
4917
|
}, ui = class extends oi {
|
|
4918
4918
|
constructor(e, t, n, r, i, a = R, o = null) {
|
|
4919
|
-
super(e, t, n, r, i, a), h(this, "_renderer", void 0), h(this, "_decoder", void 0), h(this, "_decoderReady", !1), h(this, "_decoderBusy", !1), h(this, "_decoderQueue", []), h(this, "
|
|
4919
|
+
super(e, t, n, r, i, a), h(this, "_renderer", void 0), h(this, "_decoder", void 0), h(this, "_decoderReady", !1), h(this, "_decoderBusy", !1), h(this, "_decoderQueue", []), h(this, "_fpsMeter", void 0), h(this, "_logger", void 0), this._logger = o, this._debug.debug(`StreamBuilder started for participant [${e}]`), this._initFpsMeter(), this._initRenderer(), this._initDecoder();
|
|
4920
4920
|
}
|
|
4921
4921
|
_processFrame(e) {
|
|
4922
4922
|
e.keyframe && (this._decoderQueue = []), this._decoderQueue.push(e), this._decodeQueue();
|
|
@@ -4931,11 +4931,7 @@ var Qr = class {
|
|
|
4931
4931
|
e || !ti.isBrowserSupported() ? this._decoder = new ei(this._debug, this._logger) : this._decoder = new ti(this._debug, this._logger), this._decoder.init(async (e) => {
|
|
4932
4932
|
this._decoderBusy = !1, "VideoFrame" in window && e instanceof VideoFrame ? await this._renderer.drawFrame(e) : await this._renderer.drawImage(e), this._fpsMeter.increment(), this._decodeQueue();
|
|
4933
4933
|
}, (e) => {
|
|
4934
|
-
|
|
4935
|
-
this._decoderQueue = [], !this._webCodecsRetryAttempted && e.includes("reset because error during decoding") ? (this._webCodecsRetryAttempted = !0, this._debug.warn("StreamBuilder retry WebCodecs with software decoder"), this._onKeyFrameRequested?.()) : this._switchToLibVPXDecoder();
|
|
4936
|
-
return;
|
|
4937
|
-
}
|
|
4938
|
-
this._decodeQueue();
|
|
4934
|
+
this._decoderBusy = !1, this._decodeQueue(), this._decoder instanceof ti && typeof e == "string" && e.includes("EncodingError") && this._switchToLibVPXDecoder();
|
|
4939
4935
|
}, this._onKeyFrameRequested).then(() => {
|
|
4940
4936
|
this._decoderReady = !0, this._decodeQueue();
|
|
4941
4937
|
}).catch((e) => {
|
|
@@ -4943,7 +4939,7 @@ var Qr = class {
|
|
|
4943
4939
|
});
|
|
4944
4940
|
}
|
|
4945
4941
|
_switchToLibVPXDecoder() {
|
|
4946
|
-
this._debug.warn("StreamBuilder switch to LibVPX decoder"), this.
|
|
4942
|
+
this._debug.warn("StreamBuilder switch to LibVPX decoder"), this._fpsMeter && this._fpsMeter.destroy(), this._decoder && (this._decoderReady = !1, this._decoderBusy = !1, this._decoder.destroy()), this._renderer && this._renderer.destroy(), this._initFpsMeter(), this._initRenderer(!0), this._initDecoder(!0);
|
|
4947
4943
|
}
|
|
4948
4944
|
_decodeQueue() {
|
|
4949
4945
|
if (!this._decoderReady || this._decoderBusy) return;
|
|
@@ -8112,7 +8108,7 @@ var ho = class {
|
|
|
8112
8108
|
}
|
|
8113
8109
|
}, go = class {
|
|
8114
8110
|
constructor(e, t = !1, n = R, r = null) {
|
|
8115
|
-
h(this, "_audioElement", null), h(this, "_audioTracks", /* @__PURE__ */ new Map()), h(this, "_allowMultipleTracks", void 0), h(this, "_volume", 1), h(this, "_features", { setSinkId: !!Audio.prototype.setSinkId }), h(this, "_statFirstMediaReceived", void 0), h(this, "
|
|
8111
|
+
h(this, "_audioElement", null), h(this, "_debug", void 0), h(this, "_preparedAudioElement", void 0), h(this, "_audioTracks", /* @__PURE__ */ new Map()), h(this, "_allowMultipleTracks", void 0), h(this, "_volume", 1), h(this, "_features", { setSinkId: !!Audio.prototype.setSinkId }), h(this, "_statFirstMediaReceived", void 0), h(this, "_logger", void 0), this._statFirstMediaReceived = e, this._allowMultipleTracks = t, this._debug = n, this._logger = r, this._preparedAudioElement = this._prepareAudioElement();
|
|
8116
8112
|
}
|
|
8117
8113
|
add(e, t) {
|
|
8118
8114
|
this._allowMultipleTracks || this._clearTracks();
|
|
@@ -8161,31 +8157,40 @@ var ho = class {
|
|
|
8161
8157
|
if (M.muteMode) return;
|
|
8162
8158
|
let e = this._getTracks();
|
|
8163
8159
|
if (!e.length) return;
|
|
8164
|
-
let t =
|
|
8165
|
-
|
|
8166
|
-
let
|
|
8160
|
+
let t = this._preparedAudioElement ?? this._createAudioElement();
|
|
8161
|
+
t.muted = !1, t.volume = this._volume, t.preload = "auto";
|
|
8162
|
+
let n = () => {
|
|
8167
8163
|
this._debug.warn("[audio] Error on play audio"), L.onAutoplayError();
|
|
8168
|
-
},
|
|
8169
|
-
this._debug.debug("[audio] Play audio"),
|
|
8170
|
-
let
|
|
8171
|
-
|
|
8172
|
-
},
|
|
8164
|
+
}, r = (e) => {
|
|
8165
|
+
this._debug.debug("[audio] Play audio"), t.srcObject = null, t.srcObject = new MediaStream(e), t.load();
|
|
8166
|
+
let r = t.play();
|
|
8167
|
+
r && r.catch(n);
|
|
8168
|
+
}, i = () => {
|
|
8173
8169
|
this._debug.debug("[audio] Recover audio playback");
|
|
8174
8170
|
let e = this._getTracks();
|
|
8175
|
-
e.length ?
|
|
8171
|
+
e.length ? r(e) : this._debug.warn("[audio] Broken audio tracks");
|
|
8176
8172
|
};
|
|
8177
|
-
|
|
8173
|
+
t.onpause = i, t.onstalled = i, t.onerror = i, t.onloadeddata = () => {
|
|
8178
8174
|
this._statFirstMediaReceived.measure();
|
|
8179
|
-
},
|
|
8180
|
-
let
|
|
8181
|
-
|
|
8182
|
-
this._debug.warn(`[audio] Failed to set output device '${
|
|
8175
|
+
}, r(e), this._audioElement = t;
|
|
8176
|
+
let a = T.getSavedOutput()?.deviceId;
|
|
8177
|
+
a && t.setSinkId?.(a).catch((e) => {
|
|
8178
|
+
this._debug.warn(`[audio] Failed to set output device '${a}'`, e);
|
|
8183
8179
|
});
|
|
8184
8180
|
}
|
|
8185
8181
|
_stopAudioElement() {
|
|
8186
|
-
this._audioElement && (this._audioElement.pause(), this._audioElement.srcObject = null);
|
|
8182
|
+
this._audioElement && (this._audioElement.onpause = null, this._audioElement.onstalled = null, this._audioElement.onerror = null, this._audioElement.onloadeddata = null, this._audioElement.pause(), this._audioElement.srcObject = null);
|
|
8187
8183
|
for (let e of this._audioTracks.values()) e.stop();
|
|
8188
8184
|
}
|
|
8185
|
+
_createAudioElement() {
|
|
8186
|
+
let e = T.browserName() !== "Safari" || T.isMobile() || M.safariAudioElement;
|
|
8187
|
+
return document.createElement(e ? "audio" : "video");
|
|
8188
|
+
}
|
|
8189
|
+
_prepareAudioElement() {
|
|
8190
|
+
if (M.muteMode || T.browserName() !== "Safari" || T.isMobile()) return null;
|
|
8191
|
+
let e = this._createAudioElement();
|
|
8192
|
+
return e.load(), e;
|
|
8193
|
+
}
|
|
8189
8194
|
_addTrackToAudioElement(e) {
|
|
8190
8195
|
if (!this._audioElement) return;
|
|
8191
8196
|
this._debug.debug(`[audio] Adding track ${e}`);
|
package/classes/AudioOutput.d.ts
CHANGED
|
@@ -7,12 +7,13 @@ import { StatFirstMediaReceived } from './stat/StatFirstMediaReceived';
|
|
|
7
7
|
*/
|
|
8
8
|
export default class AudioOutput {
|
|
9
9
|
protected _audioElement: HTMLAudioElement | null;
|
|
10
|
+
protected readonly _debug: DebugLogger;
|
|
11
|
+
private readonly _preparedAudioElement;
|
|
10
12
|
private _audioTracks;
|
|
11
13
|
private readonly _allowMultipleTracks;
|
|
12
14
|
private _volume;
|
|
13
15
|
private readonly _features;
|
|
14
16
|
private readonly _statFirstMediaReceived;
|
|
15
|
-
protected readonly _debug: DebugLogger;
|
|
16
17
|
private readonly _logger;
|
|
17
18
|
constructor(statFirstMediaReceived: StatFirstMediaReceived, allowMultipleTracks?: boolean, debug?: DebugLogger, logger?: StatsLogger | null);
|
|
18
19
|
add(participantId: ParticipantId, track: MediaStreamTrack): void;
|
|
@@ -25,6 +26,8 @@ export default class AudioOutput {
|
|
|
25
26
|
protected _getTracks(): MediaStreamTrack[];
|
|
26
27
|
protected _initAudioElement(): void;
|
|
27
28
|
protected _stopAudioElement(): void;
|
|
29
|
+
private _createAudioElement;
|
|
30
|
+
private _prepareAudioElement;
|
|
28
31
|
private _addTrackToAudioElement;
|
|
29
32
|
private _removeTrackFromAudioElement;
|
|
30
33
|
private _clearTracks;
|
|
@@ -9,7 +9,6 @@ export default class StreamBuilder extends BaseStreamBuilder {
|
|
|
9
9
|
private _decoderReady;
|
|
10
10
|
private _decoderBusy;
|
|
11
11
|
private _decoderQueue;
|
|
12
|
-
private _webCodecsRetryAttempted;
|
|
13
12
|
private _fpsMeter;
|
|
14
13
|
private readonly _logger;
|
|
15
14
|
constructor(participantId: ParticipantId, onStream: IOnStream, onStat: IOnStat, statAggregator: StatAggregator | null, onKeyFrameRequested: VoidFunction, debug?: DebugLogger, logger?: StatsLogger | null);
|