@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
|
@@ -4956,7 +4956,9 @@ function getOption(opts) {
|
|
|
4956
4956
|
enableSei: false,
|
|
4957
4957
|
enableOriginSdpLogger: false,
|
|
4958
4958
|
checkStatsErrorDelay: 5e3,
|
|
4959
|
+
connectionStateChangeTimeout: 5e3,
|
|
4959
4960
|
enableNetworkQuality: false,
|
|
4961
|
+
hackCreateOfferIssue: false,
|
|
4960
4962
|
networkQuality: {
|
|
4961
4963
|
networkQos: {
|
|
4962
4964
|
1: {
|
|
@@ -6729,6 +6731,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
6729
6731
|
_defineProperty$2(_assertThisInitialized$1(_this), "_preVideoStats", null);
|
|
6730
6732
|
_defineProperty$2(_assertThisInitialized$1(_this), "_rtcReportTimer", 0);
|
|
6731
6733
|
_defineProperty$2(_assertThisInitialized$1(_this), "_networkQualityResult", []);
|
|
6734
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_peerStateTimer", null);
|
|
6732
6735
|
_defineProperty$2(_assertThisInitialized$1(_this), "_checkStatsError", /* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2() {
|
|
6733
6736
|
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
6734
6737
|
while (1)
|
|
@@ -6921,26 +6924,33 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
6921
6924
|
}
|
|
6922
6925
|
encodedTransformSupported = isLegacyEncodedTransformSupported();
|
|
6923
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:
|
|
6924
6934
|
this._pc = new RTCPeerConnection({
|
|
6925
6935
|
encodedInsertableStreams: encodedTransformSupported && this._opts.enableSei ? true : void 0
|
|
6926
6936
|
});
|
|
6927
6937
|
this._bindRTCEvents();
|
|
6928
|
-
_context3.next =
|
|
6938
|
+
_context3.next = 14;
|
|
6929
6939
|
return this._connect(url);
|
|
6930
|
-
case
|
|
6931
|
-
_context3.next =
|
|
6940
|
+
case 14:
|
|
6941
|
+
_context3.next = 19;
|
|
6932
6942
|
break;
|
|
6933
|
-
case
|
|
6934
|
-
_context3.prev =
|
|
6943
|
+
case 16:
|
|
6944
|
+
_context3.prev = 16;
|
|
6935
6945
|
_context3.t0 = _context3["catch"](6);
|
|
6936
6946
|
setTimeout(function() {
|
|
6937
6947
|
return _this2._emitError(StreamingError.create(ERR.OTHER, null, _context3.t0));
|
|
6938
6948
|
});
|
|
6939
|
-
case
|
|
6949
|
+
case 19:
|
|
6940
6950
|
case "end":
|
|
6941
6951
|
return _context3.stop();
|
|
6942
6952
|
}
|
|
6943
|
-
}, _callee3, this, [[6,
|
|
6953
|
+
}, _callee3, this, [[6, 16]]);
|
|
6944
6954
|
}));
|
|
6945
6955
|
function load(_x) {
|
|
6946
6956
|
return _load.apply(this, arguments);
|
|
@@ -6960,6 +6970,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
6960
6970
|
pc.addEventListener("track", this._onTrack);
|
|
6961
6971
|
pc.addEventListener("connectionstatechange", function() {
|
|
6962
6972
|
logger.warn("onconnectionstatechange:", pc.connectionState);
|
|
6973
|
+
_this3._clearPeerStateTimeout();
|
|
6963
6974
|
_this3.emit(EXTEND_EVENTS.RTC_STATE_CHANGE, {
|
|
6964
6975
|
state: pc.connectionState,
|
|
6965
6976
|
url: _this3._url
|
|
@@ -7096,7 +7107,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7096
7107
|
this._videoTransceicer = pc.addTransceiver("video", {
|
|
7097
7108
|
direction: "recvonly"
|
|
7098
7109
|
});
|
|
7099
|
-
|
|
7110
|
+
this._opts.delayHint !== void 0 && this._setDelay(this._opts.delayHint, this._opts.videoDelaySync);
|
|
7100
7111
|
if (this._opts.enableSei) {
|
|
7101
7112
|
this.initVideoEncodedTransform();
|
|
7102
7113
|
this.initAudioEncodedTransform();
|
|
@@ -7117,6 +7128,9 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7117
7128
|
case 13:
|
|
7118
7129
|
offer = _context4.sent;
|
|
7119
7130
|
case 14:
|
|
7131
|
+
if (this._opts.hackCreateOfferIssue) {
|
|
7132
|
+
this._createEmptyPeer();
|
|
7133
|
+
}
|
|
7120
7134
|
logger.log("local offer");
|
|
7121
7135
|
logger.log(offer.sdp);
|
|
7122
7136
|
parsed = lib.parse(offer.sdp);
|
|
@@ -7141,11 +7155,11 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7141
7155
|
});
|
|
7142
7156
|
offer.sdp = lib.write(parsed);
|
|
7143
7157
|
logger.log("local offer modified:\n", offer.sdp);
|
|
7144
|
-
_context4.next =
|
|
7158
|
+
_context4.next = 23;
|
|
7145
7159
|
return pc.setLocalDescription(offer);
|
|
7146
|
-
case
|
|
7160
|
+
case 23:
|
|
7147
7161
|
finnalUrl = this._url;
|
|
7148
|
-
_context4.prev =
|
|
7162
|
+
_context4.prev = 24;
|
|
7149
7163
|
if (this._opts.preProcessUrl) {
|
|
7150
7164
|
finnalUrl = this._opts.preProcessUrl(finnalUrl).url;
|
|
7151
7165
|
}
|
|
@@ -7158,7 +7172,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7158
7172
|
sessionId
|
|
7159
7173
|
});
|
|
7160
7174
|
reqStart = Date.now();
|
|
7161
|
-
_context4.next =
|
|
7175
|
+
_context4.next = 33;
|
|
7162
7176
|
return this._loader.load(finnalUrl, {
|
|
7163
7177
|
body: JSON.stringify({
|
|
7164
7178
|
sessionId,
|
|
@@ -7166,27 +7180,27 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7166
7180
|
localSdp: offer
|
|
7167
7181
|
})
|
|
7168
7182
|
});
|
|
7169
|
-
case
|
|
7183
|
+
case 33:
|
|
7170
7184
|
res = _context4.sent;
|
|
7171
7185
|
this.emit(EVENT.LOAD_RESPONSE_HEADERS, {
|
|
7172
7186
|
headers: res.response.headers
|
|
7173
7187
|
});
|
|
7174
7188
|
answer = res === null || res === void 0 ? void 0 : res.data;
|
|
7175
7189
|
if (!((answer === null || answer === void 0 ? void 0 : answer.code) === 404 || (answer === null || answer === void 0 ? void 0 : answer.code) === 403)) {
|
|
7176
|
-
_context4.next =
|
|
7190
|
+
_context4.next = 41;
|
|
7177
7191
|
break;
|
|
7178
7192
|
}
|
|
7179
7193
|
err = StreamingError.create(answer.code === 404 ? ERR.NETWORK_NOTFOUND : ERR.NETWORK_FORBIDDEN, null, answer);
|
|
7180
7194
|
err.errorType = ERR.NETWORK;
|
|
7181
7195
|
this._emitError(err);
|
|
7182
7196
|
return _context4.abrupt("return");
|
|
7183
|
-
case
|
|
7197
|
+
case 41:
|
|
7184
7198
|
if (!((answer === null || answer === void 0 ? void 0 : answer.code) !== 200)) {
|
|
7185
|
-
_context4.next =
|
|
7199
|
+
_context4.next = 43;
|
|
7186
7200
|
break;
|
|
7187
7201
|
}
|
|
7188
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));
|
|
7189
|
-
case
|
|
7203
|
+
case 43:
|
|
7190
7204
|
logger.log("answer:");
|
|
7191
7205
|
logger.log((_answer$remoteSdp = answer.remoteSdp) === null || _answer$remoteSdp === void 0 ? void 0 : _answer$remoteSdp.sdp);
|
|
7192
7206
|
_parsed = lib.parse(answer.remoteSdp.sdp);
|
|
@@ -7215,68 +7229,88 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7215
7229
|
answer.remoteSdp.sdp = lib.write(_parsed);
|
|
7216
7230
|
logger.log("answer modified:\n", answer.remoteSdp.sdp);
|
|
7217
7231
|
this._rctConnectStartTs = Date.now();
|
|
7218
|
-
_context4.next =
|
|
7232
|
+
_context4.next = 53;
|
|
7219
7233
|
return this._pc.setRemoteDescription(answer.remoteSdp);
|
|
7220
|
-
case
|
|
7234
|
+
case 53:
|
|
7221
7235
|
this._networkEvaluate = new NetworkEvaluate(pc, this._opts.networkEvaluateInterval);
|
|
7222
|
-
|
|
7236
|
+
this._listenPeerStateTimeout();
|
|
7237
|
+
_context4.next = 60;
|
|
7223
7238
|
break;
|
|
7224
|
-
case
|
|
7225
|
-
_context4.prev =
|
|
7226
|
-
_context4.t0 = _context4["catch"](
|
|
7239
|
+
case 57:
|
|
7240
|
+
_context4.prev = 57;
|
|
7241
|
+
_context4.t0 = _context4["catch"](24);
|
|
7227
7242
|
this._emitError(StreamingError.network(_context4.t0));
|
|
7228
|
-
case
|
|
7243
|
+
case 60:
|
|
7229
7244
|
case "end":
|
|
7230
7245
|
return _context4.stop();
|
|
7231
7246
|
}
|
|
7232
|
-
}, _callee4, this, [[
|
|
7247
|
+
}, _callee4, this, [[24, 57]]);
|
|
7233
7248
|
}));
|
|
7234
7249
|
function _connect() {
|
|
7235
7250
|
return _connect2.apply(this, arguments);
|
|
7236
7251
|
}
|
|
7237
7252
|
return _connect;
|
|
7238
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
|
+
}
|
|
7239
7273
|
}, {
|
|
7240
7274
|
key: "_startRtcReport",
|
|
7241
7275
|
value: function _startRtcReport() {
|
|
7242
|
-
var
|
|
7276
|
+
var _this7 = this;
|
|
7243
7277
|
this._stopRtcReport();
|
|
7244
7278
|
this._rtcReportTimer = setInterval(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee5() {
|
|
7245
|
-
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;
|
|
7246
7280
|
return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
|
|
7247
7281
|
while (1)
|
|
7248
7282
|
switch (_context5.prev = _context5.next) {
|
|
7249
7283
|
case 0:
|
|
7250
|
-
if (!
|
|
7251
|
-
|
|
7252
|
-
|
|
7284
|
+
if (!_this7._audioStallObserver && _this7._audioTransceicer) {
|
|
7285
|
+
_this7._audioStallObserver = new AudioStallObserver();
|
|
7286
|
+
_this7._audioStallObserver.start(_this7._audioTransceicer);
|
|
7253
7287
|
}
|
|
7254
|
-
if (!
|
|
7255
|
-
|
|
7256
|
-
|
|
7288
|
+
if (!_this7._videoStallObserver && _this7._video) {
|
|
7289
|
+
_this7._videoStallObserver = new VideoStallObserver();
|
|
7290
|
+
_this7._videoStallObserver.start(_this7._media);
|
|
7257
7291
|
}
|
|
7258
|
-
if (!
|
|
7259
|
-
|
|
7292
|
+
if (!_this7._networkQuality && _this7._opts.enableNetworkQuality) {
|
|
7293
|
+
_this7._networkQuality = new NetworkQuality(_this7._pc, _this7._opts.networkQuality);
|
|
7260
7294
|
}
|
|
7261
7295
|
_context5.next = 5;
|
|
7262
|
-
return Promise.all([getRecvAudioStats(
|
|
7296
|
+
return Promise.all([getRecvAudioStats(_this7._audioTransceicer.receiver.getStats()), getRecvVideoStats(_this7._videoTransceicer.receiver.getStats())]);
|
|
7263
7297
|
case 5:
|
|
7264
7298
|
_yield$Promise$all = _context5.sent;
|
|
7265
7299
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
7266
7300
|
curAudioStats = _yield$Promise$all2[0];
|
|
7267
7301
|
curVideoStats = _yield$Promise$all2[1];
|
|
7268
|
-
if (!(
|
|
7302
|
+
if (!(_this7._preAudioStats && _this7._preVideoStats)) {
|
|
7269
7303
|
_context5.next = 21;
|
|
7270
7304
|
break;
|
|
7271
7305
|
}
|
|
7272
|
-
audioStats = diffRecvAudioStats(
|
|
7273
|
-
videoStats = diffRecvVideoStats(
|
|
7306
|
+
audioStats = diffRecvAudioStats(_this7._preAudioStats, curAudioStats);
|
|
7307
|
+
videoStats = diffRecvVideoStats(_this7._preVideoStats, curVideoStats);
|
|
7274
7308
|
_context5.next = 14;
|
|
7275
|
-
return (
|
|
7309
|
+
return (_this7$_audioStallObs = _this7._audioStallObserver) === null || _this7$_audioStallObs === void 0 ? void 0 : _this7$_audioStallObs.getAudioStallInfo();
|
|
7276
7310
|
case 14:
|
|
7277
7311
|
audioStallInfo = _context5.sent;
|
|
7278
7312
|
_context5.next = 17;
|
|
7279
|
-
return (
|
|
7313
|
+
return (_this7$_videoStallObs = _this7._videoStallObserver) === null || _this7$_videoStallObs === void 0 ? void 0 : _this7$_videoStallObs.getStallInfo({
|
|
7280
7314
|
interval: videoStats.statsInterval,
|
|
7281
7315
|
frameRateReceived: videoStats.frameRateReceived,
|
|
7282
7316
|
frameRateDecoded: videoStats.frameRateDecoded,
|
|
@@ -7284,15 +7318,15 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7284
7318
|
});
|
|
7285
7319
|
case 17:
|
|
7286
7320
|
videoStallInfo = _context5.sent;
|
|
7287
|
-
_ref4 = (
|
|
7321
|
+
_ref4 = (_this7$_networkQualit = (_this7$_networkQualit2 = _this7._networkQuality) === null || _this7$_networkQualit2 === void 0 ? void 0 : _this7$_networkQualit2.getDownlinkQuality(_objectSpread2$2(_objectSpread2$2({}, audioStats), {}, {
|
|
7288
7322
|
stallDuration: audioStallInfo.stallDuration
|
|
7289
7323
|
}), _objectSpread2$2(_objectSpread2$2({}, videoStats), {}, {
|
|
7290
7324
|
stallDuration: videoStallInfo.stall.stallDuration100ms
|
|
7291
|
-
}))) !== null &&
|
|
7292
|
-
if (
|
|
7293
|
-
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);
|
|
7294
7328
|
}
|
|
7295
|
-
|
|
7329
|
+
_this7.emit(EXTEND_EVENTS.RTC_NETWORK, {
|
|
7296
7330
|
interval: videoStats.statsInterval,
|
|
7297
7331
|
visibility_state: document.visibilityState,
|
|
7298
7332
|
network_quality: quality,
|
|
@@ -7319,12 +7353,12 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7319
7353
|
quality_qos: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos,
|
|
7320
7354
|
quality_audio_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.audioQoe,
|
|
7321
7355
|
quality_video_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.videoQoe,
|
|
7322
|
-
current_delay:
|
|
7356
|
+
current_delay: _this7._getDelay(),
|
|
7323
7357
|
target_delay: targetDelay
|
|
7324
7358
|
});
|
|
7325
7359
|
case 21:
|
|
7326
|
-
|
|
7327
|
-
|
|
7360
|
+
_this7._preAudioStats = curAudioStats;
|
|
7361
|
+
_this7._preVideoStats = curVideoStats;
|
|
7328
7362
|
case 23:
|
|
7329
7363
|
case "end":
|
|
7330
7364
|
return _context5.stop();
|
|
@@ -7377,6 +7411,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7377
7411
|
(_this$_networkEvaluat2 = this._networkEvaluate) === null || _this$_networkEvaluat2 === void 0 ? void 0 : _this$_networkEvaluat2.destroy();
|
|
7378
7412
|
this._stopRtcReport();
|
|
7379
7413
|
clearTimeout(this._checkStatsErrorTimer);
|
|
7414
|
+
this._clearPeerStateTimeout();
|
|
7380
7415
|
this._audioTransceicer = null;
|
|
7381
7416
|
this._videoTransceicer = null;
|
|
7382
7417
|
this._mediaStream = null;
|
|
@@ -7387,10 +7422,37 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7387
7422
|
value: function _emitError(error) {
|
|
7388
7423
|
this.emit(EVENT.ERROR, error);
|
|
7389
7424
|
clearTimeout(this._checkStatsErrorTimer);
|
|
7425
|
+
this._clearPeerStateTimeout();
|
|
7390
7426
|
if (this._pc) {
|
|
7391
7427
|
this._pc.close();
|
|
7392
7428
|
}
|
|
7393
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
|
+
}()
|
|
7394
7456
|
}, {
|
|
7395
7457
|
key: "destroy",
|
|
7396
7458
|
value: function destroy(keepClearMediaStream) {
|
|
@@ -7531,7 +7593,7 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
7531
7593
|
}, {
|
|
7532
7594
|
key: "version",
|
|
7533
7595
|
get: function get() {
|
|
7534
|
-
return "0.2.1-alpha.
|
|
7596
|
+
return "0.2.1-alpha.35";
|
|
7535
7597
|
}
|
|
7536
7598
|
}, {
|
|
7537
7599
|
key: "beforePlayerInit",
|