@byteplus/veplayer-plugin 2.8.0-rc.0 → 2.8.0-rc.10
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.d.ts +2 -0
- 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/esm/veplayer.strategy.base.development.js +1 -1
- package/esm/veplayer.strategy.base.production.js +1 -1
- package/package.json +1 -1
- package/umd/index.d.ts +2 -0
- 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
|
@@ -4955,11 +4955,14 @@
|
|
|
4955
4955
|
stallInterval: 400,
|
|
4956
4956
|
networkEvaluateInterval: 1e3,
|
|
4957
4957
|
delayHint: 0,
|
|
4958
|
+
videoDelaySync: false,
|
|
4958
4959
|
seamlesslyReload: false,
|
|
4959
4960
|
enableSei: false,
|
|
4960
4961
|
enableOriginSdpLogger: false,
|
|
4961
4962
|
checkStatsErrorDelay: 5e3,
|
|
4963
|
+
connectionStateChangeTimeout: 5e3,
|
|
4962
4964
|
enableNetworkQuality: false,
|
|
4965
|
+
hackCreateOfferIssue: false,
|
|
4963
4966
|
networkQuality: {
|
|
4964
4967
|
networkQos: {
|
|
4965
4968
|
1: {
|
|
@@ -6163,7 +6166,24 @@
|
|
|
6163
6166
|
};
|
|
6164
6167
|
var VideoStallObserver = /* @__PURE__ */ function() {
|
|
6165
6168
|
function VideoStallObserver2() {
|
|
6169
|
+
var _this = this;
|
|
6166
6170
|
_classCallCheck$3(this, VideoStallObserver2);
|
|
6171
|
+
_defineProperty$2(this, "_handleVisibilityChange", function() {
|
|
6172
|
+
if (document.visibilityState === "hidden") {
|
|
6173
|
+
_this._framePause();
|
|
6174
|
+
}
|
|
6175
|
+
});
|
|
6176
|
+
_defineProperty$2(this, "_framePause", function() {
|
|
6177
|
+
if (_this._prePts) {
|
|
6178
|
+
var current = performance.now();
|
|
6179
|
+
var delta = current - _this._prePts;
|
|
6180
|
+
_this._stallList.push({
|
|
6181
|
+
playTime: current,
|
|
6182
|
+
timeUpdateInterval: Math.round(delta)
|
|
6183
|
+
});
|
|
6184
|
+
_this._prePts = void 0;
|
|
6185
|
+
}
|
|
6186
|
+
});
|
|
6167
6187
|
this._removeHandler = void 0;
|
|
6168
6188
|
this._remotePlayPauseHandler = void 0;
|
|
6169
6189
|
this._prePts = void 0;
|
|
@@ -6184,20 +6204,20 @@
|
|
|
6184
6204
|
_createClass$3(VideoStallObserver2, [{
|
|
6185
6205
|
key: "start",
|
|
6186
6206
|
value: function start(player) {
|
|
6187
|
-
var
|
|
6207
|
+
var _this2 = this;
|
|
6188
6208
|
this._player = player;
|
|
6189
6209
|
if (this._support100msStall) {
|
|
6190
6210
|
if (player) {
|
|
6191
6211
|
this._requestVideoFrameCallbackTimer = player.requestVideoFrameCallback(this._onVideoRefresh.bind(this));
|
|
6192
6212
|
this._removeHandler = function() {
|
|
6193
|
-
if (
|
|
6194
|
-
player.cancelVideoFrameCallback(
|
|
6213
|
+
if (_this2._requestVideoFrameCallbackTimer) {
|
|
6214
|
+
player.cancelVideoFrameCallback(_this2._requestVideoFrameCallbackTimer);
|
|
6195
6215
|
}
|
|
6196
6216
|
};
|
|
6197
6217
|
}
|
|
6198
6218
|
} else {
|
|
6199
6219
|
var handle = function handle2() {
|
|
6200
|
-
return
|
|
6220
|
+
return _this2._onVideoTimeupdate(player);
|
|
6201
6221
|
};
|
|
6202
6222
|
player.addEventListener("timeupdate", handle);
|
|
6203
6223
|
this._removeHandler = function() {
|
|
@@ -6205,17 +6225,19 @@
|
|
|
6205
6225
|
};
|
|
6206
6226
|
}
|
|
6207
6227
|
var handlePause = function handlePause2() {
|
|
6208
|
-
return
|
|
6228
|
+
return _this2._onVideoPause();
|
|
6209
6229
|
};
|
|
6210
6230
|
player.addEventListener("pause", handlePause);
|
|
6211
6231
|
var handlePlay = function handlePlay2() {
|
|
6212
|
-
return
|
|
6232
|
+
return _this2._onVideoPlay();
|
|
6213
6233
|
};
|
|
6214
6234
|
player.addEventListener("play", handlePlay);
|
|
6215
6235
|
this._remotePlayPauseHandler = function() {
|
|
6216
6236
|
player.removeEventListener("pause", handlePause);
|
|
6217
6237
|
player.removeEventListener("play", handlePlay);
|
|
6218
6238
|
};
|
|
6239
|
+
document.addEventListener("visibilitychange", this._handleVisibilityChange);
|
|
6240
|
+
document.addEventListener("pagehide", this._framePause());
|
|
6219
6241
|
}
|
|
6220
6242
|
}, {
|
|
6221
6243
|
key: "stop",
|
|
@@ -6233,6 +6255,8 @@
|
|
|
6233
6255
|
delete this._prePts;
|
|
6234
6256
|
this._videoInWaiting100ms = false;
|
|
6235
6257
|
this._videoInWaiting500ms = false;
|
|
6258
|
+
document.removeEventListener("visibilitychange", this._handleVisibilityChange);
|
|
6259
|
+
document.removeEventListener("pagehide", this._framePause());
|
|
6236
6260
|
}
|
|
6237
6261
|
}, {
|
|
6238
6262
|
key: "destroy",
|
|
@@ -6242,7 +6266,7 @@
|
|
|
6242
6266
|
}, {
|
|
6243
6267
|
key: "getStallInfo",
|
|
6244
6268
|
value: function getStallInfo(_ref) {
|
|
6245
|
-
var
|
|
6269
|
+
var _this3 = this;
|
|
6246
6270
|
var interval = _ref.interval, frameRateReceived = _ref.frameRateReceived, frameRateDecoded = _ref.frameRateDecoded, bitrate = _ref.bitrate;
|
|
6247
6271
|
var stallInfo = {
|
|
6248
6272
|
pts: 0,
|
|
@@ -6256,7 +6280,7 @@
|
|
|
6256
6280
|
},
|
|
6257
6281
|
pauseDuration: this._getPauseDuration()
|
|
6258
6282
|
};
|
|
6259
|
-
if (this._stallList) {
|
|
6283
|
+
if (this._stallList && document.visibilityState === "visible" && !this._isPaused) {
|
|
6260
6284
|
var poorNetworkInSafari = (isSafari() || isFirefox()) && (bitrate === 0 || (frameRateDecoded || Infinity) <= 1 || (frameRateReceived || Infinity) <= 1);
|
|
6261
6285
|
if (poorNetworkInSafari || this._stallList.length === 0) {
|
|
6262
6286
|
stallInfo.stall.stallDuration500ms = interval;
|
|
@@ -6273,27 +6297,27 @@
|
|
|
6273
6297
|
this._stallList.forEach(function(frameRecord, idx) {
|
|
6274
6298
|
var timeUpdateInterval = frameRecord.timeUpdateInterval, playTime = frameRecord.playTime;
|
|
6275
6299
|
var stallDuration = timeUpdateInterval;
|
|
6276
|
-
if (idx === 0 && (
|
|
6300
|
+
if (idx === 0 && (_this3._videoInWaiting100ms || _this3._videoInWaiting500ms)) {
|
|
6277
6301
|
stallDuration = Math.round(timeUpdateInterval % interval);
|
|
6278
6302
|
}
|
|
6279
|
-
if (timeUpdateInterval >
|
|
6303
|
+
if (timeUpdateInterval > _this3._stallTimeThreshold.stall500ms) {
|
|
6280
6304
|
stallInfo.stall.stallDuration500ms += stallDuration;
|
|
6281
|
-
if (!
|
|
6305
|
+
if (!_this3._videoInWaiting500ms) {
|
|
6282
6306
|
stallInfo.stall.stallCount500ms++;
|
|
6283
6307
|
}
|
|
6284
|
-
|
|
6308
|
+
_this3._videoInWaiting500ms = true;
|
|
6285
6309
|
} else {
|
|
6286
|
-
|
|
6310
|
+
_this3._videoInWaiting500ms = false;
|
|
6287
6311
|
}
|
|
6288
|
-
if (
|
|
6289
|
-
if (timeUpdateInterval >
|
|
6312
|
+
if (_this3._support100msStall) {
|
|
6313
|
+
if (timeUpdateInterval > _this3._stallTimeThreshold.stall100ms) {
|
|
6290
6314
|
stallInfo.stall.stallDuration100ms += stallDuration;
|
|
6291
|
-
if (!
|
|
6315
|
+
if (!_this3._videoInWaiting100ms) {
|
|
6292
6316
|
stallInfo.stall.stallCount100ms++;
|
|
6293
6317
|
}
|
|
6294
|
-
|
|
6318
|
+
_this3._videoInWaiting100ms = true;
|
|
6295
6319
|
} else {
|
|
6296
|
-
|
|
6320
|
+
_this3._videoInWaiting100ms = false;
|
|
6297
6321
|
}
|
|
6298
6322
|
}
|
|
6299
6323
|
stallInfo.pts = playTime;
|
|
@@ -6332,6 +6356,7 @@
|
|
|
6332
6356
|
value: function _onVideoPause() {
|
|
6333
6357
|
this._isPaused = true;
|
|
6334
6358
|
this._pauseStart = Date.now();
|
|
6359
|
+
this._framePause();
|
|
6335
6360
|
}
|
|
6336
6361
|
}, {
|
|
6337
6362
|
key: "_onVideoPlay",
|
|
@@ -6710,11 +6735,15 @@
|
|
|
6710
6735
|
_defineProperty$2(_assertThisInitialized$1(_this), "_preVideoStats", null);
|
|
6711
6736
|
_defineProperty$2(_assertThisInitialized$1(_this), "_rtcReportTimer", 0);
|
|
6712
6737
|
_defineProperty$2(_assertThisInitialized$1(_this), "_networkQualityResult", []);
|
|
6738
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_peerStateTimer", null);
|
|
6713
6739
|
_defineProperty$2(_assertThisInitialized$1(_this), "_checkStatsError", /* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2() {
|
|
6714
6740
|
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
6715
6741
|
while (1)
|
|
6716
6742
|
switch (_context2.prev = _context2.next) {
|
|
6717
6743
|
case 0:
|
|
6744
|
+
if (_this._checkStatsErrorTimer) {
|
|
6745
|
+
clearTimeout(_this._checkStatsErrorTimer);
|
|
6746
|
+
}
|
|
6718
6747
|
_this._checkStatsErrorTimer = setTimeout(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee() {
|
|
6719
6748
|
var stats, _stats$video, framesDecoded, bytesReceived;
|
|
6720
6749
|
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
@@ -6743,7 +6772,7 @@
|
|
|
6743
6772
|
}
|
|
6744
6773
|
}, _callee);
|
|
6745
6774
|
})), _this._opts.checkStatsErrorDelay);
|
|
6746
|
-
case
|
|
6775
|
+
case 2:
|
|
6747
6776
|
case "end":
|
|
6748
6777
|
return _context2.stop();
|
|
6749
6778
|
}
|
|
@@ -6767,7 +6796,6 @@
|
|
|
6767
6796
|
});
|
|
6768
6797
|
_defineProperty$2(_assertThisInitialized$1(_this), "_onLoadedData", function() {
|
|
6769
6798
|
logger.log("loadeddata emit");
|
|
6770
|
-
_this._startRtcReport();
|
|
6771
6799
|
_this.getStatsSnapshoot().then(function(snap) {
|
|
6772
6800
|
_this.emit(EVENT.METADATA_PARSED, {
|
|
6773
6801
|
type: "video",
|
|
@@ -6782,6 +6810,7 @@
|
|
|
6782
6810
|
});
|
|
6783
6811
|
});
|
|
6784
6812
|
_defineProperty$2(_assertThisInitialized$1(_this), "_setDelay", function(delayHint) {
|
|
6813
|
+
var videoDelaySync = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
6785
6814
|
var currentDelay = _this._getDelay();
|
|
6786
6815
|
delayHint = typeof delayHint === "number" && delayHint > 0 ? delayHint : null;
|
|
6787
6816
|
if (currentDelay === delayHint)
|
|
@@ -6798,6 +6827,10 @@
|
|
|
6798
6827
|
});
|
|
6799
6828
|
if (key) {
|
|
6800
6829
|
audioReceiver[key] = delayHint;
|
|
6830
|
+
if (!videoDelaySync) {
|
|
6831
|
+
videoReceiver[key] = delayHint;
|
|
6832
|
+
logger.log("set videoReceiver.".concat(key, " = ").concat(delayHint));
|
|
6833
|
+
}
|
|
6801
6834
|
logger.log("set audioReceiver.".concat(key, " = ").concat(delayHint));
|
|
6802
6835
|
}
|
|
6803
6836
|
} catch (error) {
|
|
@@ -6895,26 +6928,33 @@
|
|
|
6895
6928
|
}
|
|
6896
6929
|
encodedTransformSupported = isLegacyEncodedTransformSupported();
|
|
6897
6930
|
_context3.prev = 6;
|
|
6931
|
+
if (!this._opts.hackCreateOfferIssue) {
|
|
6932
|
+
_context3.next = 10;
|
|
6933
|
+
break;
|
|
6934
|
+
}
|
|
6935
|
+
_context3.next = 10;
|
|
6936
|
+
return this._createEmptyPeer();
|
|
6937
|
+
case 10:
|
|
6898
6938
|
this._pc = new RTCPeerConnection({
|
|
6899
6939
|
encodedInsertableStreams: encodedTransformSupported && this._opts.enableSei ? true : void 0
|
|
6900
6940
|
});
|
|
6901
6941
|
this._bindRTCEvents();
|
|
6902
|
-
_context3.next =
|
|
6942
|
+
_context3.next = 14;
|
|
6903
6943
|
return this._connect(url);
|
|
6904
|
-
case
|
|
6905
|
-
_context3.next =
|
|
6944
|
+
case 14:
|
|
6945
|
+
_context3.next = 19;
|
|
6906
6946
|
break;
|
|
6907
|
-
case
|
|
6908
|
-
_context3.prev =
|
|
6947
|
+
case 16:
|
|
6948
|
+
_context3.prev = 16;
|
|
6909
6949
|
_context3.t0 = _context3["catch"](6);
|
|
6910
6950
|
setTimeout(function() {
|
|
6911
6951
|
return _this2._emitError(StreamingError.create(ERR.OTHER, null, _context3.t0));
|
|
6912
6952
|
});
|
|
6913
|
-
case
|
|
6953
|
+
case 19:
|
|
6914
6954
|
case "end":
|
|
6915
6955
|
return _context3.stop();
|
|
6916
6956
|
}
|
|
6917
|
-
}, _callee3, this, [[6,
|
|
6957
|
+
}, _callee3, this, [[6, 16]]);
|
|
6918
6958
|
}));
|
|
6919
6959
|
function load(_x) {
|
|
6920
6960
|
return _load.apply(this, arguments);
|
|
@@ -6934,6 +6974,7 @@
|
|
|
6934
6974
|
pc.addEventListener("track", this._onTrack);
|
|
6935
6975
|
pc.addEventListener("connectionstatechange", function() {
|
|
6936
6976
|
logger.warn("onconnectionstatechange:", pc.connectionState);
|
|
6977
|
+
_this3._clearPeerStateTimeout();
|
|
6937
6978
|
_this3.emit(EXTEND_EVENTS.RTC_STATE_CHANGE, {
|
|
6938
6979
|
state: pc.connectionState,
|
|
6939
6980
|
url: _this3._url
|
|
@@ -6958,6 +6999,7 @@
|
|
|
6958
6999
|
elapsed: Date.now() - _this3._rctConnectStartTs
|
|
6959
7000
|
});
|
|
6960
7001
|
_this3._checkStatsError();
|
|
7002
|
+
_this3._startRtcReport();
|
|
6961
7003
|
}
|
|
6962
7004
|
});
|
|
6963
7005
|
}
|
|
@@ -7069,7 +7111,7 @@
|
|
|
7069
7111
|
this._videoTransceicer = pc.addTransceiver("video", {
|
|
7070
7112
|
direction: "recvonly"
|
|
7071
7113
|
});
|
|
7072
|
-
|
|
7114
|
+
this._opts.delayHint !== void 0 && this._setDelay(this._opts.delayHint, this._opts.videoDelaySync);
|
|
7073
7115
|
if (this._opts.enableSei) {
|
|
7074
7116
|
this.initVideoEncodedTransform();
|
|
7075
7117
|
this.initAudioEncodedTransform();
|
|
@@ -7090,6 +7132,9 @@
|
|
|
7090
7132
|
case 13:
|
|
7091
7133
|
offer = _context4.sent;
|
|
7092
7134
|
case 14:
|
|
7135
|
+
if (this._opts.hackCreateOfferIssue) {
|
|
7136
|
+
this._createEmptyPeer();
|
|
7137
|
+
}
|
|
7093
7138
|
logger.log("local offer");
|
|
7094
7139
|
logger.log(offer.sdp);
|
|
7095
7140
|
parsed = lib.parse(offer.sdp);
|
|
@@ -7114,11 +7159,11 @@
|
|
|
7114
7159
|
});
|
|
7115
7160
|
offer.sdp = lib.write(parsed);
|
|
7116
7161
|
logger.log("local offer modified:\n", offer.sdp);
|
|
7117
|
-
_context4.next =
|
|
7162
|
+
_context4.next = 23;
|
|
7118
7163
|
return pc.setLocalDescription(offer);
|
|
7119
|
-
case
|
|
7164
|
+
case 23:
|
|
7120
7165
|
finnalUrl = this._url;
|
|
7121
|
-
_context4.prev =
|
|
7166
|
+
_context4.prev = 24;
|
|
7122
7167
|
if (this._opts.preProcessUrl) {
|
|
7123
7168
|
finnalUrl = this._opts.preProcessUrl(finnalUrl).url;
|
|
7124
7169
|
}
|
|
@@ -7131,7 +7176,7 @@
|
|
|
7131
7176
|
sessionId
|
|
7132
7177
|
});
|
|
7133
7178
|
reqStart = Date.now();
|
|
7134
|
-
_context4.next =
|
|
7179
|
+
_context4.next = 33;
|
|
7135
7180
|
return this._loader.load(finnalUrl, {
|
|
7136
7181
|
body: JSON.stringify({
|
|
7137
7182
|
sessionId,
|
|
@@ -7139,27 +7184,27 @@
|
|
|
7139
7184
|
localSdp: offer
|
|
7140
7185
|
})
|
|
7141
7186
|
});
|
|
7142
|
-
case
|
|
7187
|
+
case 33:
|
|
7143
7188
|
res = _context4.sent;
|
|
7144
7189
|
this.emit(EVENT.LOAD_RESPONSE_HEADERS, {
|
|
7145
7190
|
headers: res.response.headers
|
|
7146
7191
|
});
|
|
7147
7192
|
answer = res === null || res === void 0 ? void 0 : res.data;
|
|
7148
7193
|
if (!((answer === null || answer === void 0 ? void 0 : answer.code) === 404 || (answer === null || answer === void 0 ? void 0 : answer.code) === 403)) {
|
|
7149
|
-
_context4.next =
|
|
7194
|
+
_context4.next = 41;
|
|
7150
7195
|
break;
|
|
7151
7196
|
}
|
|
7152
7197
|
err = StreamingError.create(answer.code === 404 ? ERR.NETWORK_NOTFOUND : ERR.NETWORK_FORBIDDEN, null, answer);
|
|
7153
7198
|
err.errorType = ERR.NETWORK;
|
|
7154
7199
|
this._emitError(err);
|
|
7155
7200
|
return _context4.abrupt("return");
|
|
7156
|
-
case
|
|
7201
|
+
case 41:
|
|
7157
7202
|
if (!((answer === null || answer === void 0 ? void 0 : answer.code) !== 200)) {
|
|
7158
|
-
_context4.next =
|
|
7203
|
+
_context4.next = 43;
|
|
7159
7204
|
break;
|
|
7160
7205
|
}
|
|
7161
7206
|
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));
|
|
7162
|
-
case
|
|
7207
|
+
case 43:
|
|
7163
7208
|
logger.log("answer:");
|
|
7164
7209
|
logger.log((_answer$remoteSdp = answer.remoteSdp) === null || _answer$remoteSdp === void 0 ? void 0 : _answer$remoteSdp.sdp);
|
|
7165
7210
|
_parsed = lib.parse(answer.remoteSdp.sdp);
|
|
@@ -7188,67 +7233,88 @@
|
|
|
7188
7233
|
answer.remoteSdp.sdp = lib.write(_parsed);
|
|
7189
7234
|
logger.log("answer modified:\n", answer.remoteSdp.sdp);
|
|
7190
7235
|
this._rctConnectStartTs = Date.now();
|
|
7191
|
-
_context4.next =
|
|
7236
|
+
_context4.next = 53;
|
|
7192
7237
|
return this._pc.setRemoteDescription(answer.remoteSdp);
|
|
7193
|
-
case
|
|
7238
|
+
case 53:
|
|
7194
7239
|
this._networkEvaluate = new NetworkEvaluate(pc, this._opts.networkEvaluateInterval);
|
|
7195
|
-
|
|
7240
|
+
this._listenPeerStateTimeout();
|
|
7241
|
+
_context4.next = 60;
|
|
7196
7242
|
break;
|
|
7197
|
-
case
|
|
7198
|
-
_context4.prev =
|
|
7199
|
-
_context4.t0 = _context4["catch"](
|
|
7243
|
+
case 57:
|
|
7244
|
+
_context4.prev = 57;
|
|
7245
|
+
_context4.t0 = _context4["catch"](24);
|
|
7200
7246
|
this._emitError(StreamingError.network(_context4.t0));
|
|
7201
|
-
case
|
|
7247
|
+
case 60:
|
|
7202
7248
|
case "end":
|
|
7203
7249
|
return _context4.stop();
|
|
7204
7250
|
}
|
|
7205
|
-
}, _callee4, this, [[
|
|
7251
|
+
}, _callee4, this, [[24, 57]]);
|
|
7206
7252
|
}));
|
|
7207
7253
|
function _connect() {
|
|
7208
7254
|
return _connect2.apply(this, arguments);
|
|
7209
7255
|
}
|
|
7210
7256
|
return _connect;
|
|
7211
7257
|
}()
|
|
7258
|
+
}, {
|
|
7259
|
+
key: "_listenPeerStateTimeout",
|
|
7260
|
+
value: function _listenPeerStateTimeout() {
|
|
7261
|
+
var _this6 = this;
|
|
7262
|
+
this._peerStateTimer && this._clearPeerStateTimeout();
|
|
7263
|
+
if (this._opts.connectionStateChangeTimeout) {
|
|
7264
|
+
this._peerStateTimer = setTimeout(function() {
|
|
7265
|
+
_this6._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_SRC_NOT_SUPPORTED, {
|
|
7266
|
+
message: "listen connectionstatechange timeout"
|
|
7267
|
+
}));
|
|
7268
|
+
}, this._opts.connectionStateChangeTimeout);
|
|
7269
|
+
}
|
|
7270
|
+
}
|
|
7271
|
+
}, {
|
|
7272
|
+
key: "_clearPeerStateTimeout",
|
|
7273
|
+
value: function _clearPeerStateTimeout() {
|
|
7274
|
+
clearTimeout(this._peerStateTimer);
|
|
7275
|
+
this._peerStateTimer = null;
|
|
7276
|
+
}
|
|
7212
7277
|
}, {
|
|
7213
7278
|
key: "_startRtcReport",
|
|
7214
7279
|
value: function _startRtcReport() {
|
|
7215
|
-
var
|
|
7280
|
+
var _this7 = this;
|
|
7281
|
+
this._stopRtcReport();
|
|
7216
7282
|
this._rtcReportTimer = setInterval(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee5() {
|
|
7217
|
-
var _yield$Promise$all, _yield$Promise$all2, curAudioStats, curVideoStats,
|
|
7283
|
+
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;
|
|
7218
7284
|
return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
|
|
7219
7285
|
while (1)
|
|
7220
7286
|
switch (_context5.prev = _context5.next) {
|
|
7221
7287
|
case 0:
|
|
7222
|
-
if (!
|
|
7223
|
-
|
|
7224
|
-
|
|
7288
|
+
if (!_this7._audioStallObserver && _this7._audioTransceicer) {
|
|
7289
|
+
_this7._audioStallObserver = new AudioStallObserver();
|
|
7290
|
+
_this7._audioStallObserver.start(_this7._audioTransceicer);
|
|
7225
7291
|
}
|
|
7226
|
-
if (!
|
|
7227
|
-
|
|
7228
|
-
|
|
7292
|
+
if (!_this7._videoStallObserver && _this7._video) {
|
|
7293
|
+
_this7._videoStallObserver = new VideoStallObserver();
|
|
7294
|
+
_this7._videoStallObserver.start(_this7._media);
|
|
7229
7295
|
}
|
|
7230
|
-
if (!
|
|
7231
|
-
|
|
7296
|
+
if (!_this7._networkQuality && _this7._opts.enableNetworkQuality) {
|
|
7297
|
+
_this7._networkQuality = new NetworkQuality(_this7._pc, _this7._opts.networkQuality);
|
|
7232
7298
|
}
|
|
7233
7299
|
_context5.next = 5;
|
|
7234
|
-
return Promise.all([getRecvAudioStats(
|
|
7300
|
+
return Promise.all([getRecvAudioStats(_this7._audioTransceicer.receiver.getStats()), getRecvVideoStats(_this7._videoTransceicer.receiver.getStats())]);
|
|
7235
7301
|
case 5:
|
|
7236
7302
|
_yield$Promise$all = _context5.sent;
|
|
7237
7303
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
7238
7304
|
curAudioStats = _yield$Promise$all2[0];
|
|
7239
7305
|
curVideoStats = _yield$Promise$all2[1];
|
|
7240
|
-
if (!(
|
|
7306
|
+
if (!(_this7._preAudioStats && _this7._preVideoStats)) {
|
|
7241
7307
|
_context5.next = 21;
|
|
7242
7308
|
break;
|
|
7243
7309
|
}
|
|
7244
|
-
audioStats = diffRecvAudioStats(
|
|
7245
|
-
videoStats = diffRecvVideoStats(
|
|
7310
|
+
audioStats = diffRecvAudioStats(_this7._preAudioStats, curAudioStats);
|
|
7311
|
+
videoStats = diffRecvVideoStats(_this7._preVideoStats, curVideoStats);
|
|
7246
7312
|
_context5.next = 14;
|
|
7247
|
-
return (
|
|
7313
|
+
return (_this7$_audioStallObs = _this7._audioStallObserver) === null || _this7$_audioStallObs === void 0 ? void 0 : _this7$_audioStallObs.getAudioStallInfo();
|
|
7248
7314
|
case 14:
|
|
7249
7315
|
audioStallInfo = _context5.sent;
|
|
7250
7316
|
_context5.next = 17;
|
|
7251
|
-
return (
|
|
7317
|
+
return (_this7$_videoStallObs = _this7._videoStallObserver) === null || _this7$_videoStallObs === void 0 ? void 0 : _this7$_videoStallObs.getStallInfo({
|
|
7252
7318
|
interval: videoStats.statsInterval,
|
|
7253
7319
|
frameRateReceived: videoStats.frameRateReceived,
|
|
7254
7320
|
frameRateDecoded: videoStats.frameRateDecoded,
|
|
@@ -7256,15 +7322,15 @@
|
|
|
7256
7322
|
});
|
|
7257
7323
|
case 17:
|
|
7258
7324
|
videoStallInfo = _context5.sent;
|
|
7259
|
-
_ref4 = (
|
|
7325
|
+
_ref4 = (_this7$_networkQualit = (_this7$_networkQualit2 = _this7._networkQuality) === null || _this7$_networkQualit2 === void 0 ? void 0 : _this7$_networkQualit2.getDownlinkQuality(_objectSpread2$2(_objectSpread2$2({}, audioStats), {}, {
|
|
7260
7326
|
stallDuration: audioStallInfo.stallDuration
|
|
7261
7327
|
}), _objectSpread2$2(_objectSpread2$2({}, videoStats), {}, {
|
|
7262
7328
|
stallDuration: videoStallInfo.stall.stallDuration100ms
|
|
7263
|
-
}))) !== null &&
|
|
7264
|
-
if (
|
|
7265
|
-
targetDelay =
|
|
7329
|
+
}))) !== null && _this7$_networkQualit !== void 0 ? _this7$_networkQualit : [], _ref5 = _slicedToArray(_ref4, 2), quality = _ref5[0], qualityInfo = _ref5[1];
|
|
7330
|
+
if (_this7._opts.enableAdaptiveJitterBuffer) {
|
|
7331
|
+
targetDelay = _this7._handleJitterBuffer(qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos, _this7._opts.adaptiveJitterBuffer, _this7._opts.networkStrategy);
|
|
7266
7332
|
}
|
|
7267
|
-
|
|
7333
|
+
_this7.emit(EXTEND_EVENTS.RTC_NETWORK, {
|
|
7268
7334
|
interval: videoStats.statsInterval,
|
|
7269
7335
|
visibility_state: document.visibilityState,
|
|
7270
7336
|
network_quality: quality,
|
|
@@ -7291,12 +7357,12 @@
|
|
|
7291
7357
|
quality_qos: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos,
|
|
7292
7358
|
quality_audio_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.audioQoe,
|
|
7293
7359
|
quality_video_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.videoQoe,
|
|
7294
|
-
current_delay:
|
|
7360
|
+
current_delay: _this7._getDelay(),
|
|
7295
7361
|
target_delay: targetDelay
|
|
7296
7362
|
});
|
|
7297
7363
|
case 21:
|
|
7298
|
-
|
|
7299
|
-
|
|
7364
|
+
_this7._preAudioStats = curAudioStats;
|
|
7365
|
+
_this7._preVideoStats = curVideoStats;
|
|
7300
7366
|
case 23:
|
|
7301
7367
|
case "end":
|
|
7302
7368
|
return _context5.stop();
|
|
@@ -7348,6 +7414,8 @@
|
|
|
7348
7414
|
(_this$_loader = this._loader) === null || _this$_loader === void 0 ? void 0 : _this$_loader.cancel();
|
|
7349
7415
|
(_this$_networkEvaluat2 = this._networkEvaluate) === null || _this$_networkEvaluat2 === void 0 ? void 0 : _this$_networkEvaluat2.destroy();
|
|
7350
7416
|
this._stopRtcReport();
|
|
7417
|
+
clearTimeout(this._checkStatsErrorTimer);
|
|
7418
|
+
this._clearPeerStateTimeout();
|
|
7351
7419
|
this._audioTransceicer = null;
|
|
7352
7420
|
this._videoTransceicer = null;
|
|
7353
7421
|
this._mediaStream = null;
|
|
@@ -7358,10 +7426,37 @@
|
|
|
7358
7426
|
value: function _emitError(error) {
|
|
7359
7427
|
this.emit(EVENT.ERROR, error);
|
|
7360
7428
|
clearTimeout(this._checkStatsErrorTimer);
|
|
7429
|
+
this._clearPeerStateTimeout();
|
|
7361
7430
|
if (this._pc) {
|
|
7362
7431
|
this._pc.close();
|
|
7363
7432
|
}
|
|
7364
7433
|
}
|
|
7434
|
+
}, {
|
|
7435
|
+
key: "_createEmptyPeer",
|
|
7436
|
+
value: function() {
|
|
7437
|
+
var _createEmptyPeer2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6() {
|
|
7438
|
+
var pc;
|
|
7439
|
+
return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
|
|
7440
|
+
while (1)
|
|
7441
|
+
switch (_context6.prev = _context6.next) {
|
|
7442
|
+
case 0:
|
|
7443
|
+
pc = new RTCPeerConnection();
|
|
7444
|
+
_context6.next = 3;
|
|
7445
|
+
return pc.createOffer();
|
|
7446
|
+
case 3:
|
|
7447
|
+
pc.close();
|
|
7448
|
+
pc = null;
|
|
7449
|
+
case 5:
|
|
7450
|
+
case "end":
|
|
7451
|
+
return _context6.stop();
|
|
7452
|
+
}
|
|
7453
|
+
}, _callee6);
|
|
7454
|
+
}));
|
|
7455
|
+
function _createEmptyPeer() {
|
|
7456
|
+
return _createEmptyPeer2.apply(this, arguments);
|
|
7457
|
+
}
|
|
7458
|
+
return _createEmptyPeer;
|
|
7459
|
+
}()
|
|
7365
7460
|
}, {
|
|
7366
7461
|
key: "destroy",
|
|
7367
7462
|
value: function destroy(keepClearMediaStream) {
|
|
@@ -7502,7 +7597,7 @@
|
|
|
7502
7597
|
}, {
|
|
7503
7598
|
key: "version",
|
|
7504
7599
|
get: function get() {
|
|
7505
|
-
return "0.2.1-alpha.
|
|
7600
|
+
return "0.2.1-alpha.35";
|
|
7506
7601
|
}
|
|
7507
7602
|
}, {
|
|
7508
7603
|
key: "beforePlayerInit",
|