@byteplus/veplayer-plugin 2.8.0-rc.6 → 2.8.0-rc.8
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 +8632 -4331
- package/esm/index.production.js +5 -5
- package/esm/veplayer.plugin.ad.development.js +1412 -1398
- package/esm/veplayer.plugin.ad.production.js +2 -2
- package/esm/veplayer.plugin.rtm.development.js +112 -50
- 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.rtm.development.js +112 -50
- package/umd/veplayer.plugin.rtm.production.js +1 -1
|
@@ -4960,7 +4960,9 @@
|
|
|
4960
4960
|
enableSei: false,
|
|
4961
4961
|
enableOriginSdpLogger: false,
|
|
4962
4962
|
checkStatsErrorDelay: 5e3,
|
|
4963
|
+
connectionStateChangeTimeout: 5e3,
|
|
4963
4964
|
enableNetworkQuality: false,
|
|
4965
|
+
hackCreateOfferIssue: false,
|
|
4964
4966
|
networkQuality: {
|
|
4965
4967
|
networkQos: {
|
|
4966
4968
|
1: {
|
|
@@ -6733,6 +6735,7 @@
|
|
|
6733
6735
|
_defineProperty$2(_assertThisInitialized$1(_this), "_preVideoStats", null);
|
|
6734
6736
|
_defineProperty$2(_assertThisInitialized$1(_this), "_rtcReportTimer", 0);
|
|
6735
6737
|
_defineProperty$2(_assertThisInitialized$1(_this), "_networkQualityResult", []);
|
|
6738
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_peerStateTimer", null);
|
|
6736
6739
|
_defineProperty$2(_assertThisInitialized$1(_this), "_checkStatsError", /* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2() {
|
|
6737
6740
|
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
6738
6741
|
while (1)
|
|
@@ -6925,26 +6928,33 @@
|
|
|
6925
6928
|
}
|
|
6926
6929
|
encodedTransformSupported = isLegacyEncodedTransformSupported();
|
|
6927
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:
|
|
6928
6938
|
this._pc = new RTCPeerConnection({
|
|
6929
6939
|
encodedInsertableStreams: encodedTransformSupported && this._opts.enableSei ? true : void 0
|
|
6930
6940
|
});
|
|
6931
6941
|
this._bindRTCEvents();
|
|
6932
|
-
_context3.next =
|
|
6942
|
+
_context3.next = 14;
|
|
6933
6943
|
return this._connect(url);
|
|
6934
|
-
case
|
|
6935
|
-
_context3.next =
|
|
6944
|
+
case 14:
|
|
6945
|
+
_context3.next = 19;
|
|
6936
6946
|
break;
|
|
6937
|
-
case
|
|
6938
|
-
_context3.prev =
|
|
6947
|
+
case 16:
|
|
6948
|
+
_context3.prev = 16;
|
|
6939
6949
|
_context3.t0 = _context3["catch"](6);
|
|
6940
6950
|
setTimeout(function() {
|
|
6941
6951
|
return _this2._emitError(StreamingError.create(ERR.OTHER, null, _context3.t0));
|
|
6942
6952
|
});
|
|
6943
|
-
case
|
|
6953
|
+
case 19:
|
|
6944
6954
|
case "end":
|
|
6945
6955
|
return _context3.stop();
|
|
6946
6956
|
}
|
|
6947
|
-
}, _callee3, this, [[6,
|
|
6957
|
+
}, _callee3, this, [[6, 16]]);
|
|
6948
6958
|
}));
|
|
6949
6959
|
function load(_x) {
|
|
6950
6960
|
return _load.apply(this, arguments);
|
|
@@ -6964,6 +6974,7 @@
|
|
|
6964
6974
|
pc.addEventListener("track", this._onTrack);
|
|
6965
6975
|
pc.addEventListener("connectionstatechange", function() {
|
|
6966
6976
|
logger.warn("onconnectionstatechange:", pc.connectionState);
|
|
6977
|
+
_this3._clearPeerStateTimeout();
|
|
6967
6978
|
_this3.emit(EXTEND_EVENTS.RTC_STATE_CHANGE, {
|
|
6968
6979
|
state: pc.connectionState,
|
|
6969
6980
|
url: _this3._url
|
|
@@ -7100,7 +7111,7 @@
|
|
|
7100
7111
|
this._videoTransceicer = pc.addTransceiver("video", {
|
|
7101
7112
|
direction: "recvonly"
|
|
7102
7113
|
});
|
|
7103
|
-
|
|
7114
|
+
this._opts.delayHint !== void 0 && this._setDelay(this._opts.delayHint, this._opts.videoDelaySync);
|
|
7104
7115
|
if (this._opts.enableSei) {
|
|
7105
7116
|
this.initVideoEncodedTransform();
|
|
7106
7117
|
this.initAudioEncodedTransform();
|
|
@@ -7121,6 +7132,9 @@
|
|
|
7121
7132
|
case 13:
|
|
7122
7133
|
offer = _context4.sent;
|
|
7123
7134
|
case 14:
|
|
7135
|
+
if (this._opts.hackCreateOfferIssue) {
|
|
7136
|
+
this._createEmptyPeer();
|
|
7137
|
+
}
|
|
7124
7138
|
logger.log("local offer");
|
|
7125
7139
|
logger.log(offer.sdp);
|
|
7126
7140
|
parsed = lib.parse(offer.sdp);
|
|
@@ -7145,11 +7159,11 @@
|
|
|
7145
7159
|
});
|
|
7146
7160
|
offer.sdp = lib.write(parsed);
|
|
7147
7161
|
logger.log("local offer modified:\n", offer.sdp);
|
|
7148
|
-
_context4.next =
|
|
7162
|
+
_context4.next = 23;
|
|
7149
7163
|
return pc.setLocalDescription(offer);
|
|
7150
|
-
case
|
|
7164
|
+
case 23:
|
|
7151
7165
|
finnalUrl = this._url;
|
|
7152
|
-
_context4.prev =
|
|
7166
|
+
_context4.prev = 24;
|
|
7153
7167
|
if (this._opts.preProcessUrl) {
|
|
7154
7168
|
finnalUrl = this._opts.preProcessUrl(finnalUrl).url;
|
|
7155
7169
|
}
|
|
@@ -7162,7 +7176,7 @@
|
|
|
7162
7176
|
sessionId
|
|
7163
7177
|
});
|
|
7164
7178
|
reqStart = Date.now();
|
|
7165
|
-
_context4.next =
|
|
7179
|
+
_context4.next = 33;
|
|
7166
7180
|
return this._loader.load(finnalUrl, {
|
|
7167
7181
|
body: JSON.stringify({
|
|
7168
7182
|
sessionId,
|
|
@@ -7170,27 +7184,27 @@
|
|
|
7170
7184
|
localSdp: offer
|
|
7171
7185
|
})
|
|
7172
7186
|
});
|
|
7173
|
-
case
|
|
7187
|
+
case 33:
|
|
7174
7188
|
res = _context4.sent;
|
|
7175
7189
|
this.emit(EVENT.LOAD_RESPONSE_HEADERS, {
|
|
7176
7190
|
headers: res.response.headers
|
|
7177
7191
|
});
|
|
7178
7192
|
answer = res === null || res === void 0 ? void 0 : res.data;
|
|
7179
7193
|
if (!((answer === null || answer === void 0 ? void 0 : answer.code) === 404 || (answer === null || answer === void 0 ? void 0 : answer.code) === 403)) {
|
|
7180
|
-
_context4.next =
|
|
7194
|
+
_context4.next = 41;
|
|
7181
7195
|
break;
|
|
7182
7196
|
}
|
|
7183
7197
|
err = StreamingError.create(answer.code === 404 ? ERR.NETWORK_NOTFOUND : ERR.NETWORK_FORBIDDEN, null, answer);
|
|
7184
7198
|
err.errorType = ERR.NETWORK;
|
|
7185
7199
|
this._emitError(err);
|
|
7186
7200
|
return _context4.abrupt("return");
|
|
7187
|
-
case
|
|
7201
|
+
case 41:
|
|
7188
7202
|
if (!((answer === null || answer === void 0 ? void 0 : answer.code) !== 200)) {
|
|
7189
|
-
_context4.next =
|
|
7203
|
+
_context4.next = 43;
|
|
7190
7204
|
break;
|
|
7191
7205
|
}
|
|
7192
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));
|
|
7193
|
-
case
|
|
7207
|
+
case 43:
|
|
7194
7208
|
logger.log("answer:");
|
|
7195
7209
|
logger.log((_answer$remoteSdp = answer.remoteSdp) === null || _answer$remoteSdp === void 0 ? void 0 : _answer$remoteSdp.sdp);
|
|
7196
7210
|
_parsed = lib.parse(answer.remoteSdp.sdp);
|
|
@@ -7219,68 +7233,88 @@
|
|
|
7219
7233
|
answer.remoteSdp.sdp = lib.write(_parsed);
|
|
7220
7234
|
logger.log("answer modified:\n", answer.remoteSdp.sdp);
|
|
7221
7235
|
this._rctConnectStartTs = Date.now();
|
|
7222
|
-
_context4.next =
|
|
7236
|
+
_context4.next = 53;
|
|
7223
7237
|
return this._pc.setRemoteDescription(answer.remoteSdp);
|
|
7224
|
-
case
|
|
7238
|
+
case 53:
|
|
7225
7239
|
this._networkEvaluate = new NetworkEvaluate(pc, this._opts.networkEvaluateInterval);
|
|
7226
|
-
|
|
7240
|
+
this._listenPeerStateTimeout();
|
|
7241
|
+
_context4.next = 60;
|
|
7227
7242
|
break;
|
|
7228
|
-
case
|
|
7229
|
-
_context4.prev =
|
|
7230
|
-
_context4.t0 = _context4["catch"](
|
|
7243
|
+
case 57:
|
|
7244
|
+
_context4.prev = 57;
|
|
7245
|
+
_context4.t0 = _context4["catch"](24);
|
|
7231
7246
|
this._emitError(StreamingError.network(_context4.t0));
|
|
7232
|
-
case
|
|
7247
|
+
case 60:
|
|
7233
7248
|
case "end":
|
|
7234
7249
|
return _context4.stop();
|
|
7235
7250
|
}
|
|
7236
|
-
}, _callee4, this, [[
|
|
7251
|
+
}, _callee4, this, [[24, 57]]);
|
|
7237
7252
|
}));
|
|
7238
7253
|
function _connect() {
|
|
7239
7254
|
return _connect2.apply(this, arguments);
|
|
7240
7255
|
}
|
|
7241
7256
|
return _connect;
|
|
7242
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
|
+
}
|
|
7243
7277
|
}, {
|
|
7244
7278
|
key: "_startRtcReport",
|
|
7245
7279
|
value: function _startRtcReport() {
|
|
7246
|
-
var
|
|
7280
|
+
var _this7 = this;
|
|
7247
7281
|
this._stopRtcReport();
|
|
7248
7282
|
this._rtcReportTimer = setInterval(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee5() {
|
|
7249
|
-
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;
|
|
7250
7284
|
return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
|
|
7251
7285
|
while (1)
|
|
7252
7286
|
switch (_context5.prev = _context5.next) {
|
|
7253
7287
|
case 0:
|
|
7254
|
-
if (!
|
|
7255
|
-
|
|
7256
|
-
|
|
7288
|
+
if (!_this7._audioStallObserver && _this7._audioTransceicer) {
|
|
7289
|
+
_this7._audioStallObserver = new AudioStallObserver();
|
|
7290
|
+
_this7._audioStallObserver.start(_this7._audioTransceicer);
|
|
7257
7291
|
}
|
|
7258
|
-
if (!
|
|
7259
|
-
|
|
7260
|
-
|
|
7292
|
+
if (!_this7._videoStallObserver && _this7._video) {
|
|
7293
|
+
_this7._videoStallObserver = new VideoStallObserver();
|
|
7294
|
+
_this7._videoStallObserver.start(_this7._media);
|
|
7261
7295
|
}
|
|
7262
|
-
if (!
|
|
7263
|
-
|
|
7296
|
+
if (!_this7._networkQuality && _this7._opts.enableNetworkQuality) {
|
|
7297
|
+
_this7._networkQuality = new NetworkQuality(_this7._pc, _this7._opts.networkQuality);
|
|
7264
7298
|
}
|
|
7265
7299
|
_context5.next = 5;
|
|
7266
|
-
return Promise.all([getRecvAudioStats(
|
|
7300
|
+
return Promise.all([getRecvAudioStats(_this7._audioTransceicer.receiver.getStats()), getRecvVideoStats(_this7._videoTransceicer.receiver.getStats())]);
|
|
7267
7301
|
case 5:
|
|
7268
7302
|
_yield$Promise$all = _context5.sent;
|
|
7269
7303
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
7270
7304
|
curAudioStats = _yield$Promise$all2[0];
|
|
7271
7305
|
curVideoStats = _yield$Promise$all2[1];
|
|
7272
|
-
if (!(
|
|
7306
|
+
if (!(_this7._preAudioStats && _this7._preVideoStats)) {
|
|
7273
7307
|
_context5.next = 21;
|
|
7274
7308
|
break;
|
|
7275
7309
|
}
|
|
7276
|
-
audioStats = diffRecvAudioStats(
|
|
7277
|
-
videoStats = diffRecvVideoStats(
|
|
7310
|
+
audioStats = diffRecvAudioStats(_this7._preAudioStats, curAudioStats);
|
|
7311
|
+
videoStats = diffRecvVideoStats(_this7._preVideoStats, curVideoStats);
|
|
7278
7312
|
_context5.next = 14;
|
|
7279
|
-
return (
|
|
7313
|
+
return (_this7$_audioStallObs = _this7._audioStallObserver) === null || _this7$_audioStallObs === void 0 ? void 0 : _this7$_audioStallObs.getAudioStallInfo();
|
|
7280
7314
|
case 14:
|
|
7281
7315
|
audioStallInfo = _context5.sent;
|
|
7282
7316
|
_context5.next = 17;
|
|
7283
|
-
return (
|
|
7317
|
+
return (_this7$_videoStallObs = _this7._videoStallObserver) === null || _this7$_videoStallObs === void 0 ? void 0 : _this7$_videoStallObs.getStallInfo({
|
|
7284
7318
|
interval: videoStats.statsInterval,
|
|
7285
7319
|
frameRateReceived: videoStats.frameRateReceived,
|
|
7286
7320
|
frameRateDecoded: videoStats.frameRateDecoded,
|
|
@@ -7288,15 +7322,15 @@
|
|
|
7288
7322
|
});
|
|
7289
7323
|
case 17:
|
|
7290
7324
|
videoStallInfo = _context5.sent;
|
|
7291
|
-
_ref4 = (
|
|
7325
|
+
_ref4 = (_this7$_networkQualit = (_this7$_networkQualit2 = _this7._networkQuality) === null || _this7$_networkQualit2 === void 0 ? void 0 : _this7$_networkQualit2.getDownlinkQuality(_objectSpread2$2(_objectSpread2$2({}, audioStats), {}, {
|
|
7292
7326
|
stallDuration: audioStallInfo.stallDuration
|
|
7293
7327
|
}), _objectSpread2$2(_objectSpread2$2({}, videoStats), {}, {
|
|
7294
7328
|
stallDuration: videoStallInfo.stall.stallDuration100ms
|
|
7295
|
-
}))) !== null &&
|
|
7296
|
-
if (
|
|
7297
|
-
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);
|
|
7298
7332
|
}
|
|
7299
|
-
|
|
7333
|
+
_this7.emit(EXTEND_EVENTS.RTC_NETWORK, {
|
|
7300
7334
|
interval: videoStats.statsInterval,
|
|
7301
7335
|
visibility_state: document.visibilityState,
|
|
7302
7336
|
network_quality: quality,
|
|
@@ -7323,12 +7357,12 @@
|
|
|
7323
7357
|
quality_qos: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos,
|
|
7324
7358
|
quality_audio_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.audioQoe,
|
|
7325
7359
|
quality_video_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.videoQoe,
|
|
7326
|
-
current_delay:
|
|
7360
|
+
current_delay: _this7._getDelay(),
|
|
7327
7361
|
target_delay: targetDelay
|
|
7328
7362
|
});
|
|
7329
7363
|
case 21:
|
|
7330
|
-
|
|
7331
|
-
|
|
7364
|
+
_this7._preAudioStats = curAudioStats;
|
|
7365
|
+
_this7._preVideoStats = curVideoStats;
|
|
7332
7366
|
case 23:
|
|
7333
7367
|
case "end":
|
|
7334
7368
|
return _context5.stop();
|
|
@@ -7381,6 +7415,7 @@
|
|
|
7381
7415
|
(_this$_networkEvaluat2 = this._networkEvaluate) === null || _this$_networkEvaluat2 === void 0 ? void 0 : _this$_networkEvaluat2.destroy();
|
|
7382
7416
|
this._stopRtcReport();
|
|
7383
7417
|
clearTimeout(this._checkStatsErrorTimer);
|
|
7418
|
+
this._clearPeerStateTimeout();
|
|
7384
7419
|
this._audioTransceicer = null;
|
|
7385
7420
|
this._videoTransceicer = null;
|
|
7386
7421
|
this._mediaStream = null;
|
|
@@ -7391,10 +7426,37 @@
|
|
|
7391
7426
|
value: function _emitError(error) {
|
|
7392
7427
|
this.emit(EVENT.ERROR, error);
|
|
7393
7428
|
clearTimeout(this._checkStatsErrorTimer);
|
|
7429
|
+
this._clearPeerStateTimeout();
|
|
7394
7430
|
if (this._pc) {
|
|
7395
7431
|
this._pc.close();
|
|
7396
7432
|
}
|
|
7397
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
|
+
}()
|
|
7398
7460
|
}, {
|
|
7399
7461
|
key: "destroy",
|
|
7400
7462
|
value: function destroy(keepClearMediaStream) {
|
|
@@ -7535,7 +7597,7 @@
|
|
|
7535
7597
|
}, {
|
|
7536
7598
|
key: "version",
|
|
7537
7599
|
get: function get() {
|
|
7538
|
-
return "0.2.1-alpha.
|
|
7600
|
+
return "0.2.1-alpha.35";
|
|
7539
7601
|
}
|
|
7540
7602
|
}, {
|
|
7541
7603
|
key: "beforePlayerInit",
|