@volcengine/veplayer-plugin 2.8.0-rc.1 → 2.8.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/esm/index.development.js +76618 -35156
- package/esm/index.production.js +8 -7
- package/esm/veplayer.plugin.ad.development.js +1412 -1398
- package/esm/veplayer.plugin.ad.production.js +2 -2
- package/esm/veplayer.plugin.drm.development.js +147 -63
- package/esm/veplayer.plugin.drm.production.js +1 -1
- package/esm/veplayer.plugin.hlsjs.development.js +32501 -10992
- package/esm/veplayer.plugin.hlsjs.production.js +1 -1
- package/esm/veplayer.plugin.rtm.development.js +165 -70
- package/esm/veplayer.plugin.rtm.production.js +1 -1
- package/package.json +1 -1
- package/umd/veplayer.plugin.ad.development.js +1412 -1398
- package/umd/veplayer.plugin.ad.production.js +1 -1
- package/umd/veplayer.plugin.drm.development.js +148 -64
- package/umd/veplayer.plugin.drm.production.js +1 -1
- package/umd/veplayer.plugin.hlsjs.development.js +32478 -10969
- package/umd/veplayer.plugin.hlsjs.production.js +1 -1
- package/umd/veplayer.plugin.rtm.development.js +165 -70
- package/umd/veplayer.plugin.rtm.production.js +1 -1
|
@@ -4951,11 +4951,14 @@ function getOption(opts) {
|
|
|
4951
4951
|
stallInterval: 400,
|
|
4952
4952
|
networkEvaluateInterval: 1e3,
|
|
4953
4953
|
delayHint: 0,
|
|
4954
|
+
videoDelaySync: false,
|
|
4954
4955
|
seamlesslyReload: false,
|
|
4955
4956
|
enableSei: false,
|
|
4956
4957
|
enableOriginSdpLogger: false,
|
|
4957
4958
|
checkStatsErrorDelay: 5e3,
|
|
4959
|
+
connectionStateChangeTimeout: 5e3,
|
|
4958
4960
|
enableNetworkQuality: false,
|
|
4961
|
+
hackCreateOfferIssue: false,
|
|
4959
4962
|
networkQuality: {
|
|
4960
4963
|
networkQos: {
|
|
4961
4964
|
1: {
|
|
@@ -6159,7 +6162,24 @@ var checkVideoFrameCallback = function checkVideoFrameCallback2() {
|
|
|
6159
6162
|
};
|
|
6160
6163
|
var VideoStallObserver = /* @__PURE__ */ function() {
|
|
6161
6164
|
function VideoStallObserver2() {
|
|
6165
|
+
var _this = this;
|
|
6162
6166
|
_classCallCheck$3(this, VideoStallObserver2);
|
|
6167
|
+
_defineProperty$2(this, "_handleVisibilityChange", function() {
|
|
6168
|
+
if (document.visibilityState === "hidden") {
|
|
6169
|
+
_this._framePause();
|
|
6170
|
+
}
|
|
6171
|
+
});
|
|
6172
|
+
_defineProperty$2(this, "_framePause", function() {
|
|
6173
|
+
if (_this._prePts) {
|
|
6174
|
+
var current = performance.now();
|
|
6175
|
+
var delta = current - _this._prePts;
|
|
6176
|
+
_this._stallList.push({
|
|
6177
|
+
playTime: current,
|
|
6178
|
+
timeUpdateInterval: Math.round(delta)
|
|
6179
|
+
});
|
|
6180
|
+
_this._prePts = void 0;
|
|
6181
|
+
}
|
|
6182
|
+
});
|
|
6163
6183
|
this._removeHandler = void 0;
|
|
6164
6184
|
this._remotePlayPauseHandler = void 0;
|
|
6165
6185
|
this._prePts = void 0;
|
|
@@ -6180,20 +6200,20 @@ var VideoStallObserver = /* @__PURE__ */ function() {
|
|
|
6180
6200
|
_createClass$3(VideoStallObserver2, [{
|
|
6181
6201
|
key: "start",
|
|
6182
6202
|
value: function start(player) {
|
|
6183
|
-
var
|
|
6203
|
+
var _this2 = this;
|
|
6184
6204
|
this._player = player;
|
|
6185
6205
|
if (this._support100msStall) {
|
|
6186
6206
|
if (player) {
|
|
6187
6207
|
this._requestVideoFrameCallbackTimer = player.requestVideoFrameCallback(this._onVideoRefresh.bind(this));
|
|
6188
6208
|
this._removeHandler = function() {
|
|
6189
|
-
if (
|
|
6190
|
-
player.cancelVideoFrameCallback(
|
|
6209
|
+
if (_this2._requestVideoFrameCallbackTimer) {
|
|
6210
|
+
player.cancelVideoFrameCallback(_this2._requestVideoFrameCallbackTimer);
|
|
6191
6211
|
}
|
|
6192
6212
|
};
|
|
6193
6213
|
}
|
|
6194
6214
|
} else {
|
|
6195
6215
|
var handle = function handle2() {
|
|
6196
|
-
return
|
|
6216
|
+
return _this2._onVideoTimeupdate(player);
|
|
6197
6217
|
};
|
|
6198
6218
|
player.addEventListener("timeupdate", handle);
|
|
6199
6219
|
this._removeHandler = function() {
|
|
@@ -6201,17 +6221,19 @@ var VideoStallObserver = /* @__PURE__ */ function() {
|
|
|
6201
6221
|
};
|
|
6202
6222
|
}
|
|
6203
6223
|
var handlePause = function handlePause2() {
|
|
6204
|
-
return
|
|
6224
|
+
return _this2._onVideoPause();
|
|
6205
6225
|
};
|
|
6206
6226
|
player.addEventListener("pause", handlePause);
|
|
6207
6227
|
var handlePlay = function handlePlay2() {
|
|
6208
|
-
return
|
|
6228
|
+
return _this2._onVideoPlay();
|
|
6209
6229
|
};
|
|
6210
6230
|
player.addEventListener("play", handlePlay);
|
|
6211
6231
|
this._remotePlayPauseHandler = function() {
|
|
6212
6232
|
player.removeEventListener("pause", handlePause);
|
|
6213
6233
|
player.removeEventListener("play", handlePlay);
|
|
6214
6234
|
};
|
|
6235
|
+
document.addEventListener("visibilitychange", this._handleVisibilityChange);
|
|
6236
|
+
document.addEventListener("pagehide", this._framePause());
|
|
6215
6237
|
}
|
|
6216
6238
|
}, {
|
|
6217
6239
|
key: "stop",
|
|
@@ -6229,6 +6251,8 @@ var VideoStallObserver = /* @__PURE__ */ function() {
|
|
|
6229
6251
|
delete this._prePts;
|
|
6230
6252
|
this._videoInWaiting100ms = false;
|
|
6231
6253
|
this._videoInWaiting500ms = false;
|
|
6254
|
+
document.removeEventListener("visibilitychange", this._handleVisibilityChange);
|
|
6255
|
+
document.removeEventListener("pagehide", this._framePause());
|
|
6232
6256
|
}
|
|
6233
6257
|
}, {
|
|
6234
6258
|
key: "destroy",
|
|
@@ -6238,7 +6262,7 @@ var VideoStallObserver = /* @__PURE__ */ function() {
|
|
|
6238
6262
|
}, {
|
|
6239
6263
|
key: "getStallInfo",
|
|
6240
6264
|
value: function getStallInfo(_ref) {
|
|
6241
|
-
var
|
|
6265
|
+
var _this3 = this;
|
|
6242
6266
|
var interval = _ref.interval, frameRateReceived = _ref.frameRateReceived, frameRateDecoded = _ref.frameRateDecoded, bitrate = _ref.bitrate;
|
|
6243
6267
|
var stallInfo = {
|
|
6244
6268
|
pts: 0,
|
|
@@ -6252,7 +6276,7 @@ var VideoStallObserver = /* @__PURE__ */ function() {
|
|
|
6252
6276
|
},
|
|
6253
6277
|
pauseDuration: this._getPauseDuration()
|
|
6254
6278
|
};
|
|
6255
|
-
if (this._stallList) {
|
|
6279
|
+
if (this._stallList && document.visibilityState === "visible" && !this._isPaused) {
|
|
6256
6280
|
var poorNetworkInSafari = (isSafari() || isFirefox()) && (bitrate === 0 || (frameRateDecoded || Infinity) <= 1 || (frameRateReceived || Infinity) <= 1);
|
|
6257
6281
|
if (poorNetworkInSafari || this._stallList.length === 0) {
|
|
6258
6282
|
stallInfo.stall.stallDuration500ms = interval;
|
|
@@ -6269,27 +6293,27 @@ var VideoStallObserver = /* @__PURE__ */ function() {
|
|
|
6269
6293
|
this._stallList.forEach(function(frameRecord, idx) {
|
|
6270
6294
|
var timeUpdateInterval = frameRecord.timeUpdateInterval, playTime = frameRecord.playTime;
|
|
6271
6295
|
var stallDuration = timeUpdateInterval;
|
|
6272
|
-
if (idx === 0 && (
|
|
6296
|
+
if (idx === 0 && (_this3._videoInWaiting100ms || _this3._videoInWaiting500ms)) {
|
|
6273
6297
|
stallDuration = Math.round(timeUpdateInterval % interval);
|
|
6274
6298
|
}
|
|
6275
|
-
if (timeUpdateInterval >
|
|
6299
|
+
if (timeUpdateInterval > _this3._stallTimeThreshold.stall500ms) {
|
|
6276
6300
|
stallInfo.stall.stallDuration500ms += stallDuration;
|
|
6277
|
-
if (!
|
|
6301
|
+
if (!_this3._videoInWaiting500ms) {
|
|
6278
6302
|
stallInfo.stall.stallCount500ms++;
|
|
6279
6303
|
}
|
|
6280
|
-
|
|
6304
|
+
_this3._videoInWaiting500ms = true;
|
|
6281
6305
|
} else {
|
|
6282
|
-
|
|
6306
|
+
_this3._videoInWaiting500ms = false;
|
|
6283
6307
|
}
|
|
6284
|
-
if (
|
|
6285
|
-
if (timeUpdateInterval >
|
|
6308
|
+
if (_this3._support100msStall) {
|
|
6309
|
+
if (timeUpdateInterval > _this3._stallTimeThreshold.stall100ms) {
|
|
6286
6310
|
stallInfo.stall.stallDuration100ms += stallDuration;
|
|
6287
|
-
if (!
|
|
6311
|
+
if (!_this3._videoInWaiting100ms) {
|
|
6288
6312
|
stallInfo.stall.stallCount100ms++;
|
|
6289
6313
|
}
|
|
6290
|
-
|
|
6314
|
+
_this3._videoInWaiting100ms = true;
|
|
6291
6315
|
} else {
|
|
6292
|
-
|
|
6316
|
+
_this3._videoInWaiting100ms = false;
|
|
6293
6317
|
}
|
|
6294
6318
|
}
|
|
6295
6319
|
stallInfo.pts = playTime;
|
|
@@ -6328,6 +6352,7 @@ var VideoStallObserver = /* @__PURE__ */ function() {
|
|
|
6328
6352
|
value: function _onVideoPause() {
|
|
6329
6353
|
this._isPaused = true;
|
|
6330
6354
|
this._pauseStart = Date.now();
|
|
6355
|
+
this._framePause();
|
|
6331
6356
|
}
|
|
6332
6357
|
}, {
|
|
6333
6358
|
key: "_onVideoPlay",
|
|
@@ -6706,11 +6731,15 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
6706
6731
|
_defineProperty$2(_assertThisInitialized$1(_this), "_preVideoStats", null);
|
|
6707
6732
|
_defineProperty$2(_assertThisInitialized$1(_this), "_rtcReportTimer", 0);
|
|
6708
6733
|
_defineProperty$2(_assertThisInitialized$1(_this), "_networkQualityResult", []);
|
|
6734
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_peerStateTimer", null);
|
|
6709
6735
|
_defineProperty$2(_assertThisInitialized$1(_this), "_checkStatsError", /* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2() {
|
|
6710
6736
|
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
6711
6737
|
while (1)
|
|
6712
6738
|
switch (_context2.prev = _context2.next) {
|
|
6713
6739
|
case 0:
|
|
6740
|
+
if (_this._checkStatsErrorTimer) {
|
|
6741
|
+
clearTimeout(_this._checkStatsErrorTimer);
|
|
6742
|
+
}
|
|
6714
6743
|
_this._checkStatsErrorTimer = setTimeout(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee() {
|
|
6715
6744
|
var stats, _stats$video, framesDecoded, bytesReceived;
|
|
6716
6745
|
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
@@ -6739,7 +6768,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
6739
6768
|
}
|
|
6740
6769
|
}, _callee);
|
|
6741
6770
|
})), _this._opts.checkStatsErrorDelay);
|
|
6742
|
-
case
|
|
6771
|
+
case 2:
|
|
6743
6772
|
case "end":
|
|
6744
6773
|
return _context2.stop();
|
|
6745
6774
|
}
|
|
@@ -6763,7 +6792,6 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
6763
6792
|
});
|
|
6764
6793
|
_defineProperty$2(_assertThisInitialized$1(_this), "_onLoadedData", function() {
|
|
6765
6794
|
logger.log("loadeddata emit");
|
|
6766
|
-
_this._startRtcReport();
|
|
6767
6795
|
_this.getStatsSnapshoot().then(function(snap) {
|
|
6768
6796
|
_this.emit(EVENT.METADATA_PARSED, {
|
|
6769
6797
|
type: "video",
|
|
@@ -6778,6 +6806,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
6778
6806
|
});
|
|
6779
6807
|
});
|
|
6780
6808
|
_defineProperty$2(_assertThisInitialized$1(_this), "_setDelay", function(delayHint) {
|
|
6809
|
+
var videoDelaySync = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
6781
6810
|
var currentDelay = _this._getDelay();
|
|
6782
6811
|
delayHint = typeof delayHint === "number" && delayHint > 0 ? delayHint : null;
|
|
6783
6812
|
if (currentDelay === delayHint)
|
|
@@ -6794,6 +6823,10 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
6794
6823
|
});
|
|
6795
6824
|
if (key) {
|
|
6796
6825
|
audioReceiver[key] = delayHint;
|
|
6826
|
+
if (!videoDelaySync) {
|
|
6827
|
+
videoReceiver[key] = delayHint;
|
|
6828
|
+
logger.log("set videoReceiver.".concat(key, " = ").concat(delayHint));
|
|
6829
|
+
}
|
|
6797
6830
|
logger.log("set audioReceiver.".concat(key, " = ").concat(delayHint));
|
|
6798
6831
|
}
|
|
6799
6832
|
} catch (error) {
|
|
@@ -6891,26 +6924,33 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
6891
6924
|
}
|
|
6892
6925
|
encodedTransformSupported = isLegacyEncodedTransformSupported();
|
|
6893
6926
|
_context3.prev = 6;
|
|
6927
|
+
if (!this._opts.hackCreateOfferIssue) {
|
|
6928
|
+
_context3.next = 10;
|
|
6929
|
+
break;
|
|
6930
|
+
}
|
|
6931
|
+
_context3.next = 10;
|
|
6932
|
+
return this._createEmptyPeer();
|
|
6933
|
+
case 10:
|
|
6894
6934
|
this._pc = new RTCPeerConnection({
|
|
6895
6935
|
encodedInsertableStreams: encodedTransformSupported && this._opts.enableSei ? true : void 0
|
|
6896
6936
|
});
|
|
6897
6937
|
this._bindRTCEvents();
|
|
6898
|
-
_context3.next =
|
|
6938
|
+
_context3.next = 14;
|
|
6899
6939
|
return this._connect(url);
|
|
6900
|
-
case
|
|
6901
|
-
_context3.next =
|
|
6940
|
+
case 14:
|
|
6941
|
+
_context3.next = 19;
|
|
6902
6942
|
break;
|
|
6903
|
-
case
|
|
6904
|
-
_context3.prev =
|
|
6943
|
+
case 16:
|
|
6944
|
+
_context3.prev = 16;
|
|
6905
6945
|
_context3.t0 = _context3["catch"](6);
|
|
6906
6946
|
setTimeout(function() {
|
|
6907
6947
|
return _this2._emitError(StreamingError.create(ERR.OTHER, null, _context3.t0));
|
|
6908
6948
|
});
|
|
6909
|
-
case
|
|
6949
|
+
case 19:
|
|
6910
6950
|
case "end":
|
|
6911
6951
|
return _context3.stop();
|
|
6912
6952
|
}
|
|
6913
|
-
}, _callee3, this, [[6,
|
|
6953
|
+
}, _callee3, this, [[6, 16]]);
|
|
6914
6954
|
}));
|
|
6915
6955
|
function load(_x) {
|
|
6916
6956
|
return _load.apply(this, arguments);
|
|
@@ -6930,6 +6970,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
6930
6970
|
pc.addEventListener("track", this._onTrack);
|
|
6931
6971
|
pc.addEventListener("connectionstatechange", function() {
|
|
6932
6972
|
logger.warn("onconnectionstatechange:", pc.connectionState);
|
|
6973
|
+
_this3._clearPeerStateTimeout();
|
|
6933
6974
|
_this3.emit(EXTEND_EVENTS.RTC_STATE_CHANGE, {
|
|
6934
6975
|
state: pc.connectionState,
|
|
6935
6976
|
url: _this3._url
|
|
@@ -6954,6 +6995,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
6954
6995
|
elapsed: Date.now() - _this3._rctConnectStartTs
|
|
6955
6996
|
});
|
|
6956
6997
|
_this3._checkStatsError();
|
|
6998
|
+
_this3._startRtcReport();
|
|
6957
6999
|
}
|
|
6958
7000
|
});
|
|
6959
7001
|
}
|
|
@@ -7065,7 +7107,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7065
7107
|
this._videoTransceicer = pc.addTransceiver("video", {
|
|
7066
7108
|
direction: "recvonly"
|
|
7067
7109
|
});
|
|
7068
|
-
|
|
7110
|
+
this._opts.delayHint !== void 0 && this._setDelay(this._opts.delayHint, this._opts.videoDelaySync);
|
|
7069
7111
|
if (this._opts.enableSei) {
|
|
7070
7112
|
this.initVideoEncodedTransform();
|
|
7071
7113
|
this.initAudioEncodedTransform();
|
|
@@ -7086,6 +7128,9 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7086
7128
|
case 13:
|
|
7087
7129
|
offer = _context4.sent;
|
|
7088
7130
|
case 14:
|
|
7131
|
+
if (this._opts.hackCreateOfferIssue) {
|
|
7132
|
+
this._createEmptyPeer();
|
|
7133
|
+
}
|
|
7089
7134
|
logger.log("local offer");
|
|
7090
7135
|
logger.log(offer.sdp);
|
|
7091
7136
|
parsed = lib.parse(offer.sdp);
|
|
@@ -7110,11 +7155,11 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7110
7155
|
});
|
|
7111
7156
|
offer.sdp = lib.write(parsed);
|
|
7112
7157
|
logger.log("local offer modified:\n", offer.sdp);
|
|
7113
|
-
_context4.next =
|
|
7158
|
+
_context4.next = 23;
|
|
7114
7159
|
return pc.setLocalDescription(offer);
|
|
7115
|
-
case
|
|
7160
|
+
case 23:
|
|
7116
7161
|
finnalUrl = this._url;
|
|
7117
|
-
_context4.prev =
|
|
7162
|
+
_context4.prev = 24;
|
|
7118
7163
|
if (this._opts.preProcessUrl) {
|
|
7119
7164
|
finnalUrl = this._opts.preProcessUrl(finnalUrl).url;
|
|
7120
7165
|
}
|
|
@@ -7127,7 +7172,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7127
7172
|
sessionId
|
|
7128
7173
|
});
|
|
7129
7174
|
reqStart = Date.now();
|
|
7130
|
-
_context4.next =
|
|
7175
|
+
_context4.next = 33;
|
|
7131
7176
|
return this._loader.load(finnalUrl, {
|
|
7132
7177
|
body: JSON.stringify({
|
|
7133
7178
|
sessionId,
|
|
@@ -7135,27 +7180,27 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7135
7180
|
localSdp: offer
|
|
7136
7181
|
})
|
|
7137
7182
|
});
|
|
7138
|
-
case
|
|
7183
|
+
case 33:
|
|
7139
7184
|
res = _context4.sent;
|
|
7140
7185
|
this.emit(EVENT.LOAD_RESPONSE_HEADERS, {
|
|
7141
7186
|
headers: res.response.headers
|
|
7142
7187
|
});
|
|
7143
7188
|
answer = res === null || res === void 0 ? void 0 : res.data;
|
|
7144
7189
|
if (!((answer === null || answer === void 0 ? void 0 : answer.code) === 404 || (answer === null || answer === void 0 ? void 0 : answer.code) === 403)) {
|
|
7145
|
-
_context4.next =
|
|
7190
|
+
_context4.next = 41;
|
|
7146
7191
|
break;
|
|
7147
7192
|
}
|
|
7148
7193
|
err = StreamingError.create(answer.code === 404 ? ERR.NETWORK_NOTFOUND : ERR.NETWORK_FORBIDDEN, null, answer);
|
|
7149
7194
|
err.errorType = ERR.NETWORK;
|
|
7150
7195
|
this._emitError(err);
|
|
7151
7196
|
return _context4.abrupt("return");
|
|
7152
|
-
case
|
|
7197
|
+
case 41:
|
|
7153
7198
|
if (!((answer === null || answer === void 0 ? void 0 : answer.code) !== 200)) {
|
|
7154
|
-
_context4.next =
|
|
7199
|
+
_context4.next = 43;
|
|
7155
7200
|
break;
|
|
7156
7201
|
}
|
|
7157
7202
|
throw new Error("code: ".concat(answer === null || answer === void 0 ? void 0 : answer.code, ", message:").concat(answer === null || answer === void 0 ? void 0 : answer.message));
|
|
7158
|
-
case
|
|
7203
|
+
case 43:
|
|
7159
7204
|
logger.log("answer:");
|
|
7160
7205
|
logger.log((_answer$remoteSdp = answer.remoteSdp) === null || _answer$remoteSdp === void 0 ? void 0 : _answer$remoteSdp.sdp);
|
|
7161
7206
|
_parsed = lib.parse(answer.remoteSdp.sdp);
|
|
@@ -7184,67 +7229,88 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7184
7229
|
answer.remoteSdp.sdp = lib.write(_parsed);
|
|
7185
7230
|
logger.log("answer modified:\n", answer.remoteSdp.sdp);
|
|
7186
7231
|
this._rctConnectStartTs = Date.now();
|
|
7187
|
-
_context4.next =
|
|
7232
|
+
_context4.next = 53;
|
|
7188
7233
|
return this._pc.setRemoteDescription(answer.remoteSdp);
|
|
7189
|
-
case
|
|
7234
|
+
case 53:
|
|
7190
7235
|
this._networkEvaluate = new NetworkEvaluate(pc, this._opts.networkEvaluateInterval);
|
|
7191
|
-
|
|
7236
|
+
this._listenPeerStateTimeout();
|
|
7237
|
+
_context4.next = 60;
|
|
7192
7238
|
break;
|
|
7193
|
-
case
|
|
7194
|
-
_context4.prev =
|
|
7195
|
-
_context4.t0 = _context4["catch"](
|
|
7239
|
+
case 57:
|
|
7240
|
+
_context4.prev = 57;
|
|
7241
|
+
_context4.t0 = _context4["catch"](24);
|
|
7196
7242
|
this._emitError(StreamingError.network(_context4.t0));
|
|
7197
|
-
case
|
|
7243
|
+
case 60:
|
|
7198
7244
|
case "end":
|
|
7199
7245
|
return _context4.stop();
|
|
7200
7246
|
}
|
|
7201
|
-
}, _callee4, this, [[
|
|
7247
|
+
}, _callee4, this, [[24, 57]]);
|
|
7202
7248
|
}));
|
|
7203
7249
|
function _connect() {
|
|
7204
7250
|
return _connect2.apply(this, arguments);
|
|
7205
7251
|
}
|
|
7206
7252
|
return _connect;
|
|
7207
7253
|
}()
|
|
7254
|
+
}, {
|
|
7255
|
+
key: "_listenPeerStateTimeout",
|
|
7256
|
+
value: function _listenPeerStateTimeout() {
|
|
7257
|
+
var _this6 = this;
|
|
7258
|
+
this._peerStateTimer && this._clearPeerStateTimeout();
|
|
7259
|
+
if (this._opts.connectionStateChangeTimeout) {
|
|
7260
|
+
this._peerStateTimer = setTimeout(function() {
|
|
7261
|
+
_this6._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_SRC_NOT_SUPPORTED, {
|
|
7262
|
+
message: "listen connectionstatechange timeout"
|
|
7263
|
+
}));
|
|
7264
|
+
}, this._opts.connectionStateChangeTimeout);
|
|
7265
|
+
}
|
|
7266
|
+
}
|
|
7267
|
+
}, {
|
|
7268
|
+
key: "_clearPeerStateTimeout",
|
|
7269
|
+
value: function _clearPeerStateTimeout() {
|
|
7270
|
+
clearTimeout(this._peerStateTimer);
|
|
7271
|
+
this._peerStateTimer = null;
|
|
7272
|
+
}
|
|
7208
7273
|
}, {
|
|
7209
7274
|
key: "_startRtcReport",
|
|
7210
7275
|
value: function _startRtcReport() {
|
|
7211
|
-
var
|
|
7276
|
+
var _this7 = this;
|
|
7277
|
+
this._stopRtcReport();
|
|
7212
7278
|
this._rtcReportTimer = setInterval(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee5() {
|
|
7213
|
-
var _yield$Promise$all, _yield$Promise$all2, curAudioStats, curVideoStats,
|
|
7279
|
+
var _yield$Promise$all, _yield$Promise$all2, curAudioStats, curVideoStats, _this7$_audioStallObs, _this7$_videoStallObs, _this7$_networkQualit, _this7$_networkQualit2, audioStats, videoStats, audioStallInfo, videoStallInfo, _ref4, _ref5, quality, qualityInfo, targetDelay;
|
|
7214
7280
|
return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
|
|
7215
7281
|
while (1)
|
|
7216
7282
|
switch (_context5.prev = _context5.next) {
|
|
7217
7283
|
case 0:
|
|
7218
|
-
if (!
|
|
7219
|
-
|
|
7220
|
-
|
|
7284
|
+
if (!_this7._audioStallObserver && _this7._audioTransceicer) {
|
|
7285
|
+
_this7._audioStallObserver = new AudioStallObserver();
|
|
7286
|
+
_this7._audioStallObserver.start(_this7._audioTransceicer);
|
|
7221
7287
|
}
|
|
7222
|
-
if (!
|
|
7223
|
-
|
|
7224
|
-
|
|
7288
|
+
if (!_this7._videoStallObserver && _this7._video) {
|
|
7289
|
+
_this7._videoStallObserver = new VideoStallObserver();
|
|
7290
|
+
_this7._videoStallObserver.start(_this7._media);
|
|
7225
7291
|
}
|
|
7226
|
-
if (!
|
|
7227
|
-
|
|
7292
|
+
if (!_this7._networkQuality && _this7._opts.enableNetworkQuality) {
|
|
7293
|
+
_this7._networkQuality = new NetworkQuality(_this7._pc, _this7._opts.networkQuality);
|
|
7228
7294
|
}
|
|
7229
7295
|
_context5.next = 5;
|
|
7230
|
-
return Promise.all([getRecvAudioStats(
|
|
7296
|
+
return Promise.all([getRecvAudioStats(_this7._audioTransceicer.receiver.getStats()), getRecvVideoStats(_this7._videoTransceicer.receiver.getStats())]);
|
|
7231
7297
|
case 5:
|
|
7232
7298
|
_yield$Promise$all = _context5.sent;
|
|
7233
7299
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
7234
7300
|
curAudioStats = _yield$Promise$all2[0];
|
|
7235
7301
|
curVideoStats = _yield$Promise$all2[1];
|
|
7236
|
-
if (!(
|
|
7302
|
+
if (!(_this7._preAudioStats && _this7._preVideoStats)) {
|
|
7237
7303
|
_context5.next = 21;
|
|
7238
7304
|
break;
|
|
7239
7305
|
}
|
|
7240
|
-
audioStats = diffRecvAudioStats(
|
|
7241
|
-
videoStats = diffRecvVideoStats(
|
|
7306
|
+
audioStats = diffRecvAudioStats(_this7._preAudioStats, curAudioStats);
|
|
7307
|
+
videoStats = diffRecvVideoStats(_this7._preVideoStats, curVideoStats);
|
|
7242
7308
|
_context5.next = 14;
|
|
7243
|
-
return (
|
|
7309
|
+
return (_this7$_audioStallObs = _this7._audioStallObserver) === null || _this7$_audioStallObs === void 0 ? void 0 : _this7$_audioStallObs.getAudioStallInfo();
|
|
7244
7310
|
case 14:
|
|
7245
7311
|
audioStallInfo = _context5.sent;
|
|
7246
7312
|
_context5.next = 17;
|
|
7247
|
-
return (
|
|
7313
|
+
return (_this7$_videoStallObs = _this7._videoStallObserver) === null || _this7$_videoStallObs === void 0 ? void 0 : _this7$_videoStallObs.getStallInfo({
|
|
7248
7314
|
interval: videoStats.statsInterval,
|
|
7249
7315
|
frameRateReceived: videoStats.frameRateReceived,
|
|
7250
7316
|
frameRateDecoded: videoStats.frameRateDecoded,
|
|
@@ -7252,15 +7318,15 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7252
7318
|
});
|
|
7253
7319
|
case 17:
|
|
7254
7320
|
videoStallInfo = _context5.sent;
|
|
7255
|
-
_ref4 = (
|
|
7321
|
+
_ref4 = (_this7$_networkQualit = (_this7$_networkQualit2 = _this7._networkQuality) === null || _this7$_networkQualit2 === void 0 ? void 0 : _this7$_networkQualit2.getDownlinkQuality(_objectSpread2$2(_objectSpread2$2({}, audioStats), {}, {
|
|
7256
7322
|
stallDuration: audioStallInfo.stallDuration
|
|
7257
7323
|
}), _objectSpread2$2(_objectSpread2$2({}, videoStats), {}, {
|
|
7258
7324
|
stallDuration: videoStallInfo.stall.stallDuration100ms
|
|
7259
|
-
}))) !== null &&
|
|
7260
|
-
if (
|
|
7261
|
-
targetDelay =
|
|
7325
|
+
}))) !== null && _this7$_networkQualit !== void 0 ? _this7$_networkQualit : [], _ref5 = _slicedToArray(_ref4, 2), quality = _ref5[0], qualityInfo = _ref5[1];
|
|
7326
|
+
if (_this7._opts.enableAdaptiveJitterBuffer) {
|
|
7327
|
+
targetDelay = _this7._handleJitterBuffer(qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos, _this7._opts.adaptiveJitterBuffer, _this7._opts.networkStrategy);
|
|
7262
7328
|
}
|
|
7263
|
-
|
|
7329
|
+
_this7.emit(EXTEND_EVENTS.RTC_NETWORK, {
|
|
7264
7330
|
interval: videoStats.statsInterval,
|
|
7265
7331
|
visibility_state: document.visibilityState,
|
|
7266
7332
|
network_quality: quality,
|
|
@@ -7287,12 +7353,12 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7287
7353
|
quality_qos: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos,
|
|
7288
7354
|
quality_audio_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.audioQoe,
|
|
7289
7355
|
quality_video_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.videoQoe,
|
|
7290
|
-
current_delay:
|
|
7356
|
+
current_delay: _this7._getDelay(),
|
|
7291
7357
|
target_delay: targetDelay
|
|
7292
7358
|
});
|
|
7293
7359
|
case 21:
|
|
7294
|
-
|
|
7295
|
-
|
|
7360
|
+
_this7._preAudioStats = curAudioStats;
|
|
7361
|
+
_this7._preVideoStats = curVideoStats;
|
|
7296
7362
|
case 23:
|
|
7297
7363
|
case "end":
|
|
7298
7364
|
return _context5.stop();
|
|
@@ -7344,6 +7410,8 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7344
7410
|
(_this$_loader = this._loader) === null || _this$_loader === void 0 ? void 0 : _this$_loader.cancel();
|
|
7345
7411
|
(_this$_networkEvaluat2 = this._networkEvaluate) === null || _this$_networkEvaluat2 === void 0 ? void 0 : _this$_networkEvaluat2.destroy();
|
|
7346
7412
|
this._stopRtcReport();
|
|
7413
|
+
clearTimeout(this._checkStatsErrorTimer);
|
|
7414
|
+
this._clearPeerStateTimeout();
|
|
7347
7415
|
this._audioTransceicer = null;
|
|
7348
7416
|
this._videoTransceicer = null;
|
|
7349
7417
|
this._mediaStream = null;
|
|
@@ -7354,10 +7422,37 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7354
7422
|
value: function _emitError(error) {
|
|
7355
7423
|
this.emit(EVENT.ERROR, error);
|
|
7356
7424
|
clearTimeout(this._checkStatsErrorTimer);
|
|
7425
|
+
this._clearPeerStateTimeout();
|
|
7357
7426
|
if (this._pc) {
|
|
7358
7427
|
this._pc.close();
|
|
7359
7428
|
}
|
|
7360
7429
|
}
|
|
7430
|
+
}, {
|
|
7431
|
+
key: "_createEmptyPeer",
|
|
7432
|
+
value: function() {
|
|
7433
|
+
var _createEmptyPeer2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6() {
|
|
7434
|
+
var pc;
|
|
7435
|
+
return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
|
|
7436
|
+
while (1)
|
|
7437
|
+
switch (_context6.prev = _context6.next) {
|
|
7438
|
+
case 0:
|
|
7439
|
+
pc = new RTCPeerConnection();
|
|
7440
|
+
_context6.next = 3;
|
|
7441
|
+
return pc.createOffer();
|
|
7442
|
+
case 3:
|
|
7443
|
+
pc.close();
|
|
7444
|
+
pc = null;
|
|
7445
|
+
case 5:
|
|
7446
|
+
case "end":
|
|
7447
|
+
return _context6.stop();
|
|
7448
|
+
}
|
|
7449
|
+
}, _callee6);
|
|
7450
|
+
}));
|
|
7451
|
+
function _createEmptyPeer() {
|
|
7452
|
+
return _createEmptyPeer2.apply(this, arguments);
|
|
7453
|
+
}
|
|
7454
|
+
return _createEmptyPeer;
|
|
7455
|
+
}()
|
|
7361
7456
|
}, {
|
|
7362
7457
|
key: "destroy",
|
|
7363
7458
|
value: function destroy(keepClearMediaStream) {
|
|
@@ -7498,7 +7593,7 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
7498
7593
|
}, {
|
|
7499
7594
|
key: "version",
|
|
7500
7595
|
get: function get() {
|
|
7501
|
-
return "0.2.1-alpha.
|
|
7596
|
+
return "0.2.1-alpha.35";
|
|
7502
7597
|
}
|
|
7503
7598
|
}, {
|
|
7504
7599
|
key: "beforePlayerInit",
|