@byteplus/veplayer-plugin 2.8.0-rc.5 → 2.8.0-rc.7
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 +8582 -4312
- 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 +62 -31
- 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 +62 -31
- package/umd/veplayer.plugin.rtm.production.js +1 -1
|
@@ -4951,10 +4951,12 @@ 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,
|
|
4959
4961
|
networkQuality: {
|
|
4960
4962
|
networkQos: {
|
|
@@ -6728,6 +6730,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
6728
6730
|
_defineProperty$2(_assertThisInitialized$1(_this), "_preVideoStats", null);
|
|
6729
6731
|
_defineProperty$2(_assertThisInitialized$1(_this), "_rtcReportTimer", 0);
|
|
6730
6732
|
_defineProperty$2(_assertThisInitialized$1(_this), "_networkQualityResult", []);
|
|
6733
|
+
_defineProperty$2(_assertThisInitialized$1(_this), "_peerStateTimer", null);
|
|
6731
6734
|
_defineProperty$2(_assertThisInitialized$1(_this), "_checkStatsError", /* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2() {
|
|
6732
6735
|
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
6733
6736
|
while (1)
|
|
@@ -6802,6 +6805,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
6802
6805
|
});
|
|
6803
6806
|
});
|
|
6804
6807
|
_defineProperty$2(_assertThisInitialized$1(_this), "_setDelay", function(delayHint) {
|
|
6808
|
+
var videoDelaySync = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
6805
6809
|
var currentDelay = _this._getDelay();
|
|
6806
6810
|
delayHint = typeof delayHint === "number" && delayHint > 0 ? delayHint : null;
|
|
6807
6811
|
if (currentDelay === delayHint)
|
|
@@ -6818,6 +6822,10 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
6818
6822
|
});
|
|
6819
6823
|
if (key) {
|
|
6820
6824
|
audioReceiver[key] = delayHint;
|
|
6825
|
+
if (!videoDelaySync) {
|
|
6826
|
+
videoReceiver[key] = delayHint;
|
|
6827
|
+
logger.log("set videoReceiver.".concat(key, " = ").concat(delayHint));
|
|
6828
|
+
}
|
|
6821
6829
|
logger.log("set audioReceiver.".concat(key, " = ").concat(delayHint));
|
|
6822
6830
|
}
|
|
6823
6831
|
} catch (error) {
|
|
@@ -6954,6 +6962,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
6954
6962
|
pc.addEventListener("track", this._onTrack);
|
|
6955
6963
|
pc.addEventListener("connectionstatechange", function() {
|
|
6956
6964
|
logger.warn("onconnectionstatechange:", pc.connectionState);
|
|
6965
|
+
_this3._clearPeerStateTimeout();
|
|
6957
6966
|
_this3.emit(EXTEND_EVENTS.RTC_STATE_CHANGE, {
|
|
6958
6967
|
state: pc.connectionState,
|
|
6959
6968
|
url: _this3._url
|
|
@@ -7090,7 +7099,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7090
7099
|
this._videoTransceicer = pc.addTransceiver("video", {
|
|
7091
7100
|
direction: "recvonly"
|
|
7092
7101
|
});
|
|
7093
|
-
|
|
7102
|
+
this._opts.delayHint !== void 0 && this._setDelay(this._opts.delayHint, this._opts.videoDelaySync);
|
|
7094
7103
|
if (this._opts.enableSei) {
|
|
7095
7104
|
this.initVideoEncodedTransform();
|
|
7096
7105
|
this.initAudioEncodedTransform();
|
|
@@ -7213,64 +7222,84 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7213
7222
|
return this._pc.setRemoteDescription(answer.remoteSdp);
|
|
7214
7223
|
case 52:
|
|
7215
7224
|
this._networkEvaluate = new NetworkEvaluate(pc, this._opts.networkEvaluateInterval);
|
|
7216
|
-
|
|
7225
|
+
this._listenPeerStateTimeout();
|
|
7226
|
+
_context4.next = 59;
|
|
7217
7227
|
break;
|
|
7218
|
-
case
|
|
7219
|
-
_context4.prev =
|
|
7228
|
+
case 56:
|
|
7229
|
+
_context4.prev = 56;
|
|
7220
7230
|
_context4.t0 = _context4["catch"](23);
|
|
7221
7231
|
this._emitError(StreamingError.network(_context4.t0));
|
|
7222
|
-
case
|
|
7232
|
+
case 59:
|
|
7223
7233
|
case "end":
|
|
7224
7234
|
return _context4.stop();
|
|
7225
7235
|
}
|
|
7226
|
-
}, _callee4, this, [[23,
|
|
7236
|
+
}, _callee4, this, [[23, 56]]);
|
|
7227
7237
|
}));
|
|
7228
7238
|
function _connect() {
|
|
7229
7239
|
return _connect2.apply(this, arguments);
|
|
7230
7240
|
}
|
|
7231
7241
|
return _connect;
|
|
7232
7242
|
}()
|
|
7243
|
+
}, {
|
|
7244
|
+
key: "_listenPeerStateTimeout",
|
|
7245
|
+
value: function _listenPeerStateTimeout() {
|
|
7246
|
+
var _this6 = this;
|
|
7247
|
+
this._peerStateTimer && this._clearPeerStateTimeout();
|
|
7248
|
+
if (this._opts.connectionStateChangeTimeout) {
|
|
7249
|
+
this._peerStateTimer = setTimeout(function() {
|
|
7250
|
+
_this6._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_SRC_NOT_SUPPORTED, {
|
|
7251
|
+
message: "listen connectionstatechange timeout"
|
|
7252
|
+
}));
|
|
7253
|
+
}, this._opts.connectionStateChangeTimeout);
|
|
7254
|
+
}
|
|
7255
|
+
}
|
|
7256
|
+
}, {
|
|
7257
|
+
key: "_clearPeerStateTimeout",
|
|
7258
|
+
value: function _clearPeerStateTimeout() {
|
|
7259
|
+
clearTimeout(this._peerStateTimer);
|
|
7260
|
+
this._peerStateTimer = null;
|
|
7261
|
+
}
|
|
7233
7262
|
}, {
|
|
7234
7263
|
key: "_startRtcReport",
|
|
7235
7264
|
value: function _startRtcReport() {
|
|
7236
|
-
var
|
|
7265
|
+
var _this7 = this;
|
|
7237
7266
|
this._stopRtcReport();
|
|
7238
7267
|
this._rtcReportTimer = setInterval(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee5() {
|
|
7239
|
-
var _yield$Promise$all, _yield$Promise$all2, curAudioStats, curVideoStats,
|
|
7268
|
+
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;
|
|
7240
7269
|
return _regeneratorRuntime$1().wrap(function _callee5$(_context5) {
|
|
7241
7270
|
while (1)
|
|
7242
7271
|
switch (_context5.prev = _context5.next) {
|
|
7243
7272
|
case 0:
|
|
7244
|
-
if (!
|
|
7245
|
-
|
|
7246
|
-
|
|
7273
|
+
if (!_this7._audioStallObserver && _this7._audioTransceicer) {
|
|
7274
|
+
_this7._audioStallObserver = new AudioStallObserver();
|
|
7275
|
+
_this7._audioStallObserver.start(_this7._audioTransceicer);
|
|
7247
7276
|
}
|
|
7248
|
-
if (!
|
|
7249
|
-
|
|
7250
|
-
|
|
7277
|
+
if (!_this7._videoStallObserver && _this7._video) {
|
|
7278
|
+
_this7._videoStallObserver = new VideoStallObserver();
|
|
7279
|
+
_this7._videoStallObserver.start(_this7._media);
|
|
7251
7280
|
}
|
|
7252
|
-
if (!
|
|
7253
|
-
|
|
7281
|
+
if (!_this7._networkQuality && _this7._opts.enableNetworkQuality) {
|
|
7282
|
+
_this7._networkQuality = new NetworkQuality(_this7._pc, _this7._opts.networkQuality);
|
|
7254
7283
|
}
|
|
7255
7284
|
_context5.next = 5;
|
|
7256
|
-
return Promise.all([getRecvAudioStats(
|
|
7285
|
+
return Promise.all([getRecvAudioStats(_this7._audioTransceicer.receiver.getStats()), getRecvVideoStats(_this7._videoTransceicer.receiver.getStats())]);
|
|
7257
7286
|
case 5:
|
|
7258
7287
|
_yield$Promise$all = _context5.sent;
|
|
7259
7288
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
7260
7289
|
curAudioStats = _yield$Promise$all2[0];
|
|
7261
7290
|
curVideoStats = _yield$Promise$all2[1];
|
|
7262
|
-
if (!(
|
|
7291
|
+
if (!(_this7._preAudioStats && _this7._preVideoStats)) {
|
|
7263
7292
|
_context5.next = 21;
|
|
7264
7293
|
break;
|
|
7265
7294
|
}
|
|
7266
|
-
audioStats = diffRecvAudioStats(
|
|
7267
|
-
videoStats = diffRecvVideoStats(
|
|
7295
|
+
audioStats = diffRecvAudioStats(_this7._preAudioStats, curAudioStats);
|
|
7296
|
+
videoStats = diffRecvVideoStats(_this7._preVideoStats, curVideoStats);
|
|
7268
7297
|
_context5.next = 14;
|
|
7269
|
-
return (
|
|
7298
|
+
return (_this7$_audioStallObs = _this7._audioStallObserver) === null || _this7$_audioStallObs === void 0 ? void 0 : _this7$_audioStallObs.getAudioStallInfo();
|
|
7270
7299
|
case 14:
|
|
7271
7300
|
audioStallInfo = _context5.sent;
|
|
7272
7301
|
_context5.next = 17;
|
|
7273
|
-
return (
|
|
7302
|
+
return (_this7$_videoStallObs = _this7._videoStallObserver) === null || _this7$_videoStallObs === void 0 ? void 0 : _this7$_videoStallObs.getStallInfo({
|
|
7274
7303
|
interval: videoStats.statsInterval,
|
|
7275
7304
|
frameRateReceived: videoStats.frameRateReceived,
|
|
7276
7305
|
frameRateDecoded: videoStats.frameRateDecoded,
|
|
@@ -7278,15 +7307,15 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7278
7307
|
});
|
|
7279
7308
|
case 17:
|
|
7280
7309
|
videoStallInfo = _context5.sent;
|
|
7281
|
-
_ref4 = (
|
|
7310
|
+
_ref4 = (_this7$_networkQualit = (_this7$_networkQualit2 = _this7._networkQuality) === null || _this7$_networkQualit2 === void 0 ? void 0 : _this7$_networkQualit2.getDownlinkQuality(_objectSpread2$2(_objectSpread2$2({}, audioStats), {}, {
|
|
7282
7311
|
stallDuration: audioStallInfo.stallDuration
|
|
7283
7312
|
}), _objectSpread2$2(_objectSpread2$2({}, videoStats), {}, {
|
|
7284
7313
|
stallDuration: videoStallInfo.stall.stallDuration100ms
|
|
7285
|
-
}))) !== null &&
|
|
7286
|
-
if (
|
|
7287
|
-
targetDelay =
|
|
7314
|
+
}))) !== null && _this7$_networkQualit !== void 0 ? _this7$_networkQualit : [], _ref5 = _slicedToArray(_ref4, 2), quality = _ref5[0], qualityInfo = _ref5[1];
|
|
7315
|
+
if (_this7._opts.enableAdaptiveJitterBuffer) {
|
|
7316
|
+
targetDelay = _this7._handleJitterBuffer(qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos, _this7._opts.adaptiveJitterBuffer, _this7._opts.networkStrategy);
|
|
7288
7317
|
}
|
|
7289
|
-
|
|
7318
|
+
_this7.emit(EXTEND_EVENTS.RTC_NETWORK, {
|
|
7290
7319
|
interval: videoStats.statsInterval,
|
|
7291
7320
|
visibility_state: document.visibilityState,
|
|
7292
7321
|
network_quality: quality,
|
|
@@ -7313,12 +7342,12 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7313
7342
|
quality_qos: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos,
|
|
7314
7343
|
quality_audio_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.audioQoe,
|
|
7315
7344
|
quality_video_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.videoQoe,
|
|
7316
|
-
current_delay:
|
|
7345
|
+
current_delay: _this7._getDelay(),
|
|
7317
7346
|
target_delay: targetDelay
|
|
7318
7347
|
});
|
|
7319
7348
|
case 21:
|
|
7320
|
-
|
|
7321
|
-
|
|
7349
|
+
_this7._preAudioStats = curAudioStats;
|
|
7350
|
+
_this7._preVideoStats = curVideoStats;
|
|
7322
7351
|
case 23:
|
|
7323
7352
|
case "end":
|
|
7324
7353
|
return _context5.stop();
|
|
@@ -7371,6 +7400,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7371
7400
|
(_this$_networkEvaluat2 = this._networkEvaluate) === null || _this$_networkEvaluat2 === void 0 ? void 0 : _this$_networkEvaluat2.destroy();
|
|
7372
7401
|
this._stopRtcReport();
|
|
7373
7402
|
clearTimeout(this._checkStatsErrorTimer);
|
|
7403
|
+
this._clearPeerStateTimeout();
|
|
7374
7404
|
this._audioTransceicer = null;
|
|
7375
7405
|
this._videoTransceicer = null;
|
|
7376
7406
|
this._mediaStream = null;
|
|
@@ -7381,6 +7411,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7381
7411
|
value: function _emitError(error) {
|
|
7382
7412
|
this.emit(EVENT.ERROR, error);
|
|
7383
7413
|
clearTimeout(this._checkStatsErrorTimer);
|
|
7414
|
+
this._clearPeerStateTimeout();
|
|
7384
7415
|
if (this._pc) {
|
|
7385
7416
|
this._pc.close();
|
|
7386
7417
|
}
|
|
@@ -7525,7 +7556,7 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
7525
7556
|
}, {
|
|
7526
7557
|
key: "version",
|
|
7527
7558
|
get: function get() {
|
|
7528
|
-
return "0.2.1-alpha.
|
|
7559
|
+
return "0.2.1-alpha.34";
|
|
7529
7560
|
}
|
|
7530
7561
|
}, {
|
|
7531
7562
|
key: "beforePlayerInit",
|