@byteplus/veplayer-plugin 2.10.3-rc.1 → 2.10.4-rc.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 +2034 -2146
- package/esm/index.production.js +7 -7
- package/esm/veplayer.plugin.flv.development.js +4 -3
- package/esm/veplayer.plugin.flv.production.js +1 -1
- package/esm/veplayer.plugin.rtm.development.js +304 -155
- package/esm/veplayer.plugin.rtm.production.js +1 -1
- package/package.json +1 -1
- package/umd/veplayer.plugin.flv.development.js +4 -3
- package/umd/veplayer.plugin.flv.production.js +1 -1
- package/umd/veplayer.plugin.rtm.development.js +304 -155
- package/umd/veplayer.plugin.rtm.production.js +1 -1
|
@@ -5081,9 +5081,9 @@
|
|
|
5081
5081
|
lib.parseRemoteCandidates = parser.parseRemoteCandidates;
|
|
5082
5082
|
lib.parseImageAttributes = parser.parseImageAttributes;
|
|
5083
5083
|
lib.parseSimulcastStreamList = parser.parseSimulcastStreamList;
|
|
5084
|
-
var _excluded = ["adaptiveJitterBuffer"];
|
|
5084
|
+
var _excluded = ["adaptiveJitterBuffer", "standardizeKillSwitch"];
|
|
5085
5085
|
function getOption(options) {
|
|
5086
|
-
var _ref = options || {}, _ref$adaptiveJitterBu = _ref.adaptiveJitterBuffer, adaptiveJitterBuffer = _ref$adaptiveJitterBu === void 0 ? {} : _ref$adaptiveJitterBu, opts = _objectWithoutProperties$1(_ref, _excluded);
|
|
5086
|
+
var _ref = options || {}, _ref$adaptiveJitterBu = _ref.adaptiveJitterBuffer, adaptiveJitterBuffer = _ref$adaptiveJitterBu === void 0 ? {} : _ref$adaptiveJitterBu, _ref$standardizeKillS = _ref.standardizeKillSwitch, standardizeKillSwitch = _ref$standardizeKillS === void 0 ? {} : _ref$standardizeKillS, opts = _objectWithoutProperties$1(_ref, _excluded);
|
|
5087
5087
|
return _objectSpread2$2({
|
|
5088
5088
|
retryCount: 0,
|
|
5089
5089
|
retryDelay: 1e3,
|
|
@@ -5154,7 +5154,12 @@
|
|
|
5154
5154
|
5: {
|
|
5155
5155
|
jitterBuffer: 3
|
|
5156
5156
|
}
|
|
5157
|
-
}
|
|
5157
|
+
},
|
|
5158
|
+
standardizeKillSwitch: _objectSpread2$2({
|
|
5159
|
+
sld_fmtp_opus: true,
|
|
5160
|
+
sld_rtcpfb_opus_nack: true,
|
|
5161
|
+
sld_fmtp_sps_pps: true
|
|
5162
|
+
}, standardizeKillSwitch)
|
|
5158
5163
|
}, opts);
|
|
5159
5164
|
}
|
|
5160
5165
|
function _getStats(stats) {
|
|
@@ -5496,7 +5501,7 @@
|
|
|
5496
5501
|
});
|
|
5497
5502
|
}
|
|
5498
5503
|
var isEncodedTransformSupported = function isEncodedTransformSupported2() {
|
|
5499
|
-
return typeof TransformStream !== "undefined" && typeof RTCRtpSender !== "undefined" && typeof RTCRtpReceiver !== "undefined" && typeof RTCRtpScriptTransform !== "undefined" && "transform" in RTCRtpSender.prototype && "transform" in RTCRtpReceiver.prototype && isWorkerSupported() && isMessageChannelSupported();
|
|
5504
|
+
return typeof window.TransformStream !== "undefined" && typeof window.RTCRtpSender !== "undefined" && typeof window.RTCRtpReceiver !== "undefined" && typeof window.RTCRtpScriptTransform !== "undefined" && "transform" in window.RTCRtpSender.prototype && "transform" in window.RTCRtpReceiver.prototype && isWorkerSupported() && isMessageChannelSupported();
|
|
5500
5505
|
};
|
|
5501
5506
|
var isWorkerSupported = function isWorkerSupported2() {
|
|
5502
5507
|
return typeof window !== "undefined" && window.Worker;
|
|
@@ -5505,7 +5510,7 @@
|
|
|
5505
5510
|
return typeof MessageChannel !== "undefined";
|
|
5506
5511
|
};
|
|
5507
5512
|
var isLegacyEncodedTransformSupported = function isLegacyEncodedTransformSupported2() {
|
|
5508
|
-
return typeof TransformStream !== "undefined" && typeof RTCRtpSender !== "undefined" && typeof RTCRtpReceiver !== "undefined" && typeof RTCRtpSender.prototype.createEncodedStreams !== "undefined" && typeof RTCRtpReceiver.prototype.createEncodedStreams !== "undefined";
|
|
5513
|
+
return typeof window.TransformStream !== "undefined" && typeof window.RTCRtpSender !== "undefined" && typeof window.RTCRtpReceiver !== "undefined" && typeof window.RTCRtpSender.prototype.createEncodedStreams !== "undefined" && typeof window.RTCRtpReceiver.prototype.createEncodedStreams !== "undefined";
|
|
5509
5514
|
};
|
|
5510
5515
|
var Nalunit = {
|
|
5511
5516
|
getNALUnits: function getNALUnits(buffer) {
|
|
@@ -6683,6 +6688,8 @@
|
|
|
6683
6688
|
currentStats.firCount = stat.firCount;
|
|
6684
6689
|
currentStats.nackCount = stat.nackCount;
|
|
6685
6690
|
currentStats.pliCount = stat.pliCount;
|
|
6691
|
+
currentStats.fecPacketsReceived = stat.fecPacketsReceived;
|
|
6692
|
+
currentStats.fecSsrc = stat.fecSsrc;
|
|
6686
6693
|
if (stat.jitterBufferDelay !== void 0) {
|
|
6687
6694
|
currentStats.jitterBufferEmittedCount = stat.jitterBufferEmittedCount;
|
|
6688
6695
|
currentStats.jitterBufferDelay = stat.jitterBufferDelay;
|
|
@@ -6747,12 +6754,14 @@
|
|
|
6747
6754
|
nackCount,
|
|
6748
6755
|
pliCount: diffNumber(oldStats, newStats, "pliCount"),
|
|
6749
6756
|
e2eDelay: Math.round((newStats.rtt || 0) + jitterBufferDelay),
|
|
6750
|
-
retransmittedRate: +(nackCount / (packetsReceived + packetsLostDiff)).toFixed(2)
|
|
6757
|
+
retransmittedRate: +(nackCount / (packetsReceived + packetsLostDiff)).toFixed(2),
|
|
6758
|
+
fecPacketsReceived: diffNumber(oldStats, newStats, "fecPacketsReceived"),
|
|
6759
|
+
fecSsrc: newStats.fecSsrc
|
|
6751
6760
|
};
|
|
6752
6761
|
}
|
|
6753
6762
|
function diffNumber(oldValue, newValue, key) {
|
|
6754
|
-
var oldV = Number.
|
|
6755
|
-
var newV = Number.
|
|
6763
|
+
var oldV = !Number.isFinite(oldValue[key]) ? 0 : +oldValue[key];
|
|
6764
|
+
var newV = !Number.isFinite(newValue[key]) ? 0 : +newValue[key];
|
|
6756
6765
|
return Math.max(0, newV - oldV);
|
|
6757
6766
|
}
|
|
6758
6767
|
var QoELevel = {
|
|
@@ -6883,6 +6892,63 @@
|
|
|
6883
6892
|
}]);
|
|
6884
6893
|
return NetworkQuality2;
|
|
6885
6894
|
}();
|
|
6895
|
+
var gpuInfo;
|
|
6896
|
+
function getGpuInfo() {
|
|
6897
|
+
if (!gpuInfo) {
|
|
6898
|
+
gpuInfo = _getGpuInfo();
|
|
6899
|
+
}
|
|
6900
|
+
return gpuInfo;
|
|
6901
|
+
}
|
|
6902
|
+
function _getGpuInfo() {
|
|
6903
|
+
var canvas = document.createElement("canvas");
|
|
6904
|
+
var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
|
|
6905
|
+
if (!gl) {
|
|
6906
|
+
return {
|
|
6907
|
+
renderer: "unknown(WebGLRenderingContext not existed)",
|
|
6908
|
+
vendor: "unknown(WebGLRenderingContext not existed)"
|
|
6909
|
+
};
|
|
6910
|
+
}
|
|
6911
|
+
var info = gl.getExtension("WEBGL_debug_renderer_info");
|
|
6912
|
+
if (!info) {
|
|
6913
|
+
return {
|
|
6914
|
+
renderer: "unknown(info not existed)",
|
|
6915
|
+
vendor: "unknown(info not existed)"
|
|
6916
|
+
};
|
|
6917
|
+
}
|
|
6918
|
+
var renderer = gl.getParameter(info.UNMASKED_RENDERER_WEBGL);
|
|
6919
|
+
var vendor = gl.getParameter(info.UNMASKED_VENDOR_WEBGL);
|
|
6920
|
+
if (canvas && canvas.parentNode) {
|
|
6921
|
+
canvas.parentNode.removeChild(canvas);
|
|
6922
|
+
}
|
|
6923
|
+
canvas = void 0;
|
|
6924
|
+
gl = void 0;
|
|
6925
|
+
return {
|
|
6926
|
+
renderer,
|
|
6927
|
+
vendor
|
|
6928
|
+
};
|
|
6929
|
+
}
|
|
6930
|
+
function extractProfileInfo(sdpFmtpLine) {
|
|
6931
|
+
var profileLevelId = "";
|
|
6932
|
+
if (!sdpFmtpLine) {
|
|
6933
|
+
return profileLevelId;
|
|
6934
|
+
}
|
|
6935
|
+
var paramArray = sdpFmtpLine.split(";");
|
|
6936
|
+
var _iterator = _createForOfIteratorHelper$1(paramArray), _step;
|
|
6937
|
+
try {
|
|
6938
|
+
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
6939
|
+
var param = _step.value;
|
|
6940
|
+
var _param$trim$split = param.trim().split("="), _param$trim$split2 = _slicedToArray(_param$trim$split, 2), key = _param$trim$split2[0], value = _param$trim$split2[1];
|
|
6941
|
+
if (key === "profile-level-id") {
|
|
6942
|
+
profileLevelId = value;
|
|
6943
|
+
}
|
|
6944
|
+
}
|
|
6945
|
+
} catch (err) {
|
|
6946
|
+
_iterator.e(err);
|
|
6947
|
+
} finally {
|
|
6948
|
+
_iterator.f();
|
|
6949
|
+
}
|
|
6950
|
+
return profileLevelId;
|
|
6951
|
+
}
|
|
6886
6952
|
var FIRST_FRAME_STATE_ORDER = [RTC_FIRST_FRAME_STATE.LOAD_START, RTC_FIRST_FRAME_STATE.OFFER_SDP_READY, RTC_FIRST_FRAME_STATE.ANSWER_SDP_RECV, RTC_FIRST_FRAME_STATE.ANSWER_SDP_READY, RTC_FIRST_FRAME_STATE.ICE_CONNECTED, RTC_FIRST_FRAME_STATE.DTLS_CONNECTED, RTC_FIRST_FRAME_STATE.PEER_CONNECTED, RTC_FIRST_FRAME_STATE.FIRST_PACKET_RECV, RTC_FIRST_FRAME_STATE.FIRST_FRAME_RECV, RTC_FIRST_FRAME_STATE.FIRST_FRAME_DECODED, RTC_FIRST_FRAME_STATE.VIDEO_LOADEDDATA, RTC_FIRST_FRAME_STATE.VIDEO_CANPLAY, RTC_FIRST_FRAME_STATE.VIDEO_PLAYING];
|
|
6887
6953
|
var FirstFrameObserver = /* @__PURE__ */ function() {
|
|
6888
6954
|
function FirstFrameObserver2(_emitFirstFrameState) {
|
|
@@ -6896,6 +6962,7 @@
|
|
|
6896
6962
|
this._pc = null;
|
|
6897
6963
|
this._video = null;
|
|
6898
6964
|
this._videoTransceiver = null;
|
|
6965
|
+
this._audioTransceiver = null;
|
|
6899
6966
|
this._extraInfo = {
|
|
6900
6967
|
is_preload: false
|
|
6901
6968
|
};
|
|
@@ -6968,11 +7035,12 @@
|
|
|
6968
7035
|
}
|
|
6969
7036
|
}, {
|
|
6970
7037
|
key: "bindEvents",
|
|
6971
|
-
value: function bindEvents(pc, videoTransceiver, video) {
|
|
7038
|
+
value: function bindEvents(pc, videoTransceiver, audioTransceiver, video) {
|
|
6972
7039
|
var _this3 = this;
|
|
6973
7040
|
this._pc = pc;
|
|
6974
7041
|
this._video = video;
|
|
6975
7042
|
this._videoTransceiver = videoTransceiver;
|
|
7043
|
+
this._audioTransceiver = audioTransceiver;
|
|
6976
7044
|
pc.addEventListener("connectionstatechange", this._handleConnectionStateChange);
|
|
6977
7045
|
pc.addEventListener("iceconnectionstatechange", this._handleICEConnectionStateChange);
|
|
6978
7046
|
var _ref2 = (videoTransceiver === null || videoTransceiver === void 0 ? void 0 : videoTransceiver.receiver) || {}, transport = _ref2.transport;
|
|
@@ -7046,7 +7114,9 @@
|
|
|
7046
7114
|
if (Object.keys(this._state).length > 0) {
|
|
7047
7115
|
var state = _objectSpread2$2({}, this._state);
|
|
7048
7116
|
var extraInfo = _objectSpread2$2({}, this._extraInfo);
|
|
7049
|
-
getTransportInfo(this._videoTransceiver, extraInfo).
|
|
7117
|
+
Promise.all([getTransportInfo(this._videoTransceiver, extraInfo), getAudioCodecInfo(this._audioTransceiver, extraInfo)]).catch(function(e) {
|
|
7118
|
+
extraInfo.failure_reason = e.message;
|
|
7119
|
+
}).finally(function() {
|
|
7050
7120
|
_this5._emitFirstFrameState(state, extraInfo);
|
|
7051
7121
|
});
|
|
7052
7122
|
}
|
|
@@ -7065,6 +7135,7 @@
|
|
|
7065
7135
|
this._pc = null;
|
|
7066
7136
|
this._video = null;
|
|
7067
7137
|
this._videoTransceiver = null;
|
|
7138
|
+
this._audioTransceiver = null;
|
|
7068
7139
|
}
|
|
7069
7140
|
}]);
|
|
7070
7141
|
return FirstFrameObserver2;
|
|
@@ -7072,7 +7143,7 @@
|
|
|
7072
7143
|
var getTransportInfo = /* @__PURE__ */ function() {
|
|
7073
7144
|
var _ref4 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2(videoTransceiver, extraInfo) {
|
|
7074
7145
|
var _videoTransceiver$rec;
|
|
7075
|
-
var reports, candidatePairStats, localCandidateStats, remoteCandidateStats;
|
|
7146
|
+
var reports, candidatePairStats, localCandidateStats, remoteCandidateStats, inboundRtpStats, codecStats, _inboundRtpStats4;
|
|
7076
7147
|
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
7077
7148
|
while (1)
|
|
7078
7149
|
switch (_context2.prev = _context2.next) {
|
|
@@ -7087,6 +7158,9 @@
|
|
|
7087
7158
|
candidatePairStats = report;
|
|
7088
7159
|
localCandidateStats = reports.get(report.localCandidateId);
|
|
7089
7160
|
remoteCandidateStats = reports.get(report.remoteCandidateId);
|
|
7161
|
+
} else if (report.type === "inbound-rtp") {
|
|
7162
|
+
inboundRtpStats = report;
|
|
7163
|
+
codecStats = reports.get(report.codecId);
|
|
7090
7164
|
}
|
|
7091
7165
|
});
|
|
7092
7166
|
if (remoteCandidateStats) {
|
|
@@ -7107,7 +7181,20 @@
|
|
|
7107
7181
|
extraInfo.stun_responses_sent = candidatePairStats.responsesSent;
|
|
7108
7182
|
extraInfo.stun_responses_received = candidatePairStats.responsesReceived;
|
|
7109
7183
|
}
|
|
7110
|
-
|
|
7184
|
+
if (codecStats) {
|
|
7185
|
+
extraInfo.video_codec = codecStats.mimeType;
|
|
7186
|
+
extraInfo.video_fmtp = codecStats.sdpFmtpLine;
|
|
7187
|
+
extraInfo.video_profile_level_id = extractProfileInfo(codecStats.sdpFmtpLine);
|
|
7188
|
+
}
|
|
7189
|
+
if (inboundRtpStats) {
|
|
7190
|
+
extraInfo.video_width = inboundRtpStats.frameWidth;
|
|
7191
|
+
extraInfo.video_height = inboundRtpStats.frameHeight;
|
|
7192
|
+
extraInfo.video_framerate = inboundRtpStats.framesPerSecond;
|
|
7193
|
+
extraInfo.video_decoder_name = inboundRtpStats.decoderImplementation;
|
|
7194
|
+
extraInfo.video_result = ((_inboundRtpStats4 = inboundRtpStats) === null || _inboundRtpStats4 === void 0 ? void 0 : _inboundRtpStats4.framesDecoded) > 0 ? true : false;
|
|
7195
|
+
}
|
|
7196
|
+
extraInfo.gpu_info = getGpuInfo().renderer;
|
|
7197
|
+
case 10:
|
|
7111
7198
|
case "end":
|
|
7112
7199
|
return _context2.stop();
|
|
7113
7200
|
}
|
|
@@ -7117,6 +7204,43 @@
|
|
|
7117
7204
|
return _ref4.apply(this, arguments);
|
|
7118
7205
|
};
|
|
7119
7206
|
}();
|
|
7207
|
+
var getAudioCodecInfo = /* @__PURE__ */ function() {
|
|
7208
|
+
var _ref5 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee3(audioTransceiver, extraInfo) {
|
|
7209
|
+
var _audioTransceiver$rec;
|
|
7210
|
+
var reports, inboundRtpStats, codecStats, _inboundRtpStats5, _inboundRtpStats6, _inboundRtpStats7, _inboundRtpStats8, _inboundRtpStats9, _inboundRtpStats10;
|
|
7211
|
+
return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
|
|
7212
|
+
while (1)
|
|
7213
|
+
switch (_context3.prev = _context3.next) {
|
|
7214
|
+
case 0:
|
|
7215
|
+
_context3.next = 2;
|
|
7216
|
+
return audioTransceiver === null || audioTransceiver === void 0 ? void 0 : (_audioTransceiver$rec = audioTransceiver.receiver) === null || _audioTransceiver$rec === void 0 ? void 0 : _audioTransceiver$rec.getStats().catch(function() {
|
|
7217
|
+
});
|
|
7218
|
+
case 2:
|
|
7219
|
+
reports = _context3.sent;
|
|
7220
|
+
reports === null || reports === void 0 ? void 0 : reports.forEach(function(report) {
|
|
7221
|
+
if (report.type === "inbound-rtp") {
|
|
7222
|
+
inboundRtpStats = report;
|
|
7223
|
+
codecStats = reports.get(report.codecId);
|
|
7224
|
+
}
|
|
7225
|
+
});
|
|
7226
|
+
if (codecStats) {
|
|
7227
|
+
extraInfo.audio_codec = codecStats.mimeType;
|
|
7228
|
+
extraInfo.audio_fmtp = codecStats.sdpFmtpLine;
|
|
7229
|
+
}
|
|
7230
|
+
if (inboundRtpStats) {
|
|
7231
|
+
extraInfo.audio_packet_received = ((_inboundRtpStats5 = inboundRtpStats) === null || _inboundRtpStats5 === void 0 ? void 0 : _inboundRtpStats5.packetsReceived) > 0;
|
|
7232
|
+
extraInfo.audio_result = ((_inboundRtpStats6 = inboundRtpStats) === null || _inboundRtpStats6 === void 0 ? void 0 : _inboundRtpStats6.audioLevel) !== 0 || ((_inboundRtpStats7 = inboundRtpStats) === null || _inboundRtpStats7 === void 0 ? void 0 : _inboundRtpStats7.totalAudioEnergy) !== 0 || ((_inboundRtpStats8 = inboundRtpStats) === null || _inboundRtpStats8 === void 0 ? void 0 : _inboundRtpStats8.totalSamplesReceived) > 0 && ((_inboundRtpStats9 = inboundRtpStats) === null || _inboundRtpStats9 === void 0 ? void 0 : _inboundRtpStats9.totalSamplesReceived) !== ((_inboundRtpStats10 = inboundRtpStats) === null || _inboundRtpStats10 === void 0 ? void 0 : _inboundRtpStats10.concealedSamples) ? true : false;
|
|
7233
|
+
}
|
|
7234
|
+
case 6:
|
|
7235
|
+
case "end":
|
|
7236
|
+
return _context3.stop();
|
|
7237
|
+
}
|
|
7238
|
+
}, _callee3);
|
|
7239
|
+
}));
|
|
7240
|
+
return function getAudioCodecInfo2(_x3, _x4) {
|
|
7241
|
+
return _ref5.apply(this, arguments);
|
|
7242
|
+
};
|
|
7243
|
+
}();
|
|
7120
7244
|
function changeNumberInRange(source, min, max, delta) {
|
|
7121
7245
|
var target = source + delta;
|
|
7122
7246
|
if (target > max) {
|
|
@@ -7180,6 +7304,9 @@
|
|
|
7180
7304
|
function isVivoBrowser() {
|
|
7181
7305
|
return /(VivoBrowser)/i.test(navigator.userAgent);
|
|
7182
7306
|
}
|
|
7307
|
+
function isPositiveNumber(num) {
|
|
7308
|
+
return typeof num === "number" && num > 0;
|
|
7309
|
+
}
|
|
7183
7310
|
var VideoFrameRecvCallback = /* @__PURE__ */ function() {
|
|
7184
7311
|
function VideoFrameRecvCallback2() {
|
|
7185
7312
|
var _this = this;
|
|
@@ -7270,7 +7397,8 @@
|
|
|
7270
7397
|
clearTimeout(_this._checkStatsErrorTimer);
|
|
7271
7398
|
}
|
|
7272
7399
|
_this._checkStatsErrorTimer = setTimeout(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee() {
|
|
7273
|
-
var
|
|
7400
|
+
var _stats$video, _stats$audio, _stats$video2, _stats$video3;
|
|
7401
|
+
var stats;
|
|
7274
7402
|
return _regeneratorRuntime$1().wrap(function _callee$(_context) {
|
|
7275
7403
|
while (1)
|
|
7276
7404
|
switch (_context.prev = _context.next) {
|
|
@@ -7279,19 +7407,17 @@
|
|
|
7279
7407
|
return _this.getStatsSnapshoot();
|
|
7280
7408
|
case 2:
|
|
7281
7409
|
stats = _context.sent;
|
|
7282
|
-
if (stats.video) {
|
|
7283
|
-
|
|
7284
|
-
|
|
7285
|
-
|
|
7286
|
-
|
|
7287
|
-
|
|
7288
|
-
|
|
7289
|
-
|
|
7290
|
-
|
|
7291
|
-
}));
|
|
7292
|
-
}
|
|
7410
|
+
if (!isPositiveNumber((_stats$video = stats.video) === null || _stats$video === void 0 ? void 0 : _stats$video.bytesReceived) && !isPositiveNumber((_stats$audio = stats.audio) === null || _stats$audio === void 0 ? void 0 : _stats$audio.bytesReceived)) {
|
|
7411
|
+
_this._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_DECODE, {
|
|
7412
|
+
message: "rts receive empty"
|
|
7413
|
+
}));
|
|
7414
|
+
}
|
|
7415
|
+
if (isPositiveNumber((_stats$video2 = stats.video) === null || _stats$video2 === void 0 ? void 0 : _stats$video2.bytesReceived) && !isPositiveNumber((_stats$video3 = stats.video) === null || _stats$video3 === void 0 ? void 0 : _stats$video3.framesDecoded)) {
|
|
7416
|
+
_this._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_DECODE, {
|
|
7417
|
+
message: "rts decode error"
|
|
7418
|
+
}));
|
|
7293
7419
|
}
|
|
7294
|
-
case
|
|
7420
|
+
case 5:
|
|
7295
7421
|
case "end":
|
|
7296
7422
|
return _context.stop();
|
|
7297
7423
|
}
|
|
@@ -7395,13 +7521,13 @@
|
|
|
7395
7521
|
_this$_opts$adaptiveJ = _this._opts.adaptiveJitterBuffer, loopInterval = _this$_opts$adaptiveJ.loopInterval, maxAvSyncDelay = _this$_opts$adaptiveJ.maxAvSyncDelay, maxJitterBufferDiff = _this$_opts$adaptiveJ.maxJitterBufferDiff, maxStep = _this$_opts$adaptiveJ.maxStep;
|
|
7396
7522
|
avDiffTooMuchCount = 0;
|
|
7397
7523
|
_this._setDelayTimer = setInterval(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee3() {
|
|
7398
|
-
var _this$_audioTransceic4, _this$_videoTransceic3, currentTargetDelay, targetDelayMs, currentTargetDelayMs, _yield$Promise$all, _yield$Promise$all2, curAudioStats, curVideoStats, audioStats, videoStats, av_sync_diff, currentAudioDelay, currentVideoDelay, addOrReduce, nextJitterBufferDelay;
|
|
7524
|
+
var _this$_audioTransceic4, _this$_audioTransceic5, _this$_videoTransceic3, _this$_videoTransceic4, currentTargetDelay, targetDelayMs, currentTargetDelayMs, _yield$Promise$all, _yield$Promise$all2, curAudioStats, curVideoStats, audioStats, videoStats, av_sync_diff, currentAudioDelay, currentVideoDelay, addOrReduce, nextJitterBufferDelay;
|
|
7399
7525
|
return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
|
|
7400
7526
|
while (1)
|
|
7401
7527
|
switch (_context3.prev = _context3.next) {
|
|
7402
7528
|
case 0:
|
|
7403
7529
|
_context3.prev = 0;
|
|
7404
|
-
if (!(!((_this$_audioTransceic4 = _this._audioTransceicer) !== null && _this$_audioTransceic4 !== void 0 && _this$_audioTransceic4.receiver) || !((_this$_videoTransceic3 = _this._videoTransceicer) !== null && _this$_videoTransceic3 !== void 0 && _this$_videoTransceic3.receiver))) {
|
|
7530
|
+
if (!(!((_this$_audioTransceic4 = _this._audioTransceicer) !== null && _this$_audioTransceic4 !== void 0 && (_this$_audioTransceic5 = _this$_audioTransceic4.receiver) !== null && _this$_audioTransceic5 !== void 0 && _this$_audioTransceic5.getStats) || !((_this$_videoTransceic3 = _this._videoTransceicer) !== null && _this$_videoTransceic3 !== void 0 && (_this$_videoTransceic4 = _this$_videoTransceic3.receiver) !== null && _this$_videoTransceic4 !== void 0 && _this$_videoTransceic4.getStats))) {
|
|
7405
7531
|
_context3.next = 5;
|
|
7406
7532
|
break;
|
|
7407
7533
|
}
|
|
@@ -7492,20 +7618,19 @@
|
|
|
7492
7618
|
}();
|
|
7493
7619
|
_this._getDelay = function() {
|
|
7494
7620
|
try {
|
|
7495
|
-
var _this$
|
|
7621
|
+
var _this$_audioTransceic7;
|
|
7496
7622
|
var key = ["playoutDelayHint", "jitterBufferDelayHint", "jitterBufferTarget"].find(function(key2) {
|
|
7497
|
-
var _this$
|
|
7498
|
-
return key2 in (((_this$
|
|
7623
|
+
var _this$_videoTransceic5, _this$_audioTransceic6;
|
|
7624
|
+
return key2 in (((_this$_videoTransceic5 = _this._videoTransceicer) === null || _this$_videoTransceic5 === void 0 ? void 0 : _this$_videoTransceic5.receiver) || {}) && key2 in (((_this$_audioTransceic6 = _this._audioTransceicer) === null || _this$_audioTransceic6 === void 0 ? void 0 : _this$_audioTransceic6.receiver) || {});
|
|
7499
7625
|
});
|
|
7500
7626
|
if (!key)
|
|
7501
7627
|
return;
|
|
7502
|
-
return (_this$
|
|
7628
|
+
return (_this$_audioTransceic7 = _this._audioTransceicer) === null || _this$_audioTransceic7 === void 0 ? void 0 : _this$_audioTransceic7.receiver[key];
|
|
7503
7629
|
} catch (error) {
|
|
7504
7630
|
logger.error("get delay error");
|
|
7505
7631
|
}
|
|
7506
7632
|
};
|
|
7507
7633
|
_this._onLoaderRetry = function(error, retryTime) {
|
|
7508
|
-
console.log(error, "retryTime", retryTime);
|
|
7509
7634
|
_this.emit(EVENT.LOAD_RETRY, {
|
|
7510
7635
|
error: StreamingError.network(error),
|
|
7511
7636
|
retryTime
|
|
@@ -7597,7 +7722,7 @@
|
|
|
7597
7722
|
value: function() {
|
|
7598
7723
|
var _load = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6(url, failureReason) {
|
|
7599
7724
|
var _this2 = this;
|
|
7600
|
-
var lastPc, answerSdp, errorStr, preloadPromise, info, encodedTransformSupported;
|
|
7725
|
+
var lastPc, pc, answerSdp, errorStr, preloadPromise, info, encodedTransformSupported;
|
|
7601
7726
|
return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
|
|
7602
7727
|
while (1)
|
|
7603
7728
|
switch (_context6.prev = _context6.next) {
|
|
@@ -7605,44 +7730,47 @@
|
|
|
7605
7730
|
logger.log("load()", 'invoked, url: "'.concat(url, '"'));
|
|
7606
7731
|
this._disconnect(failureReason || "invoke load");
|
|
7607
7732
|
this._url = url;
|
|
7733
|
+
this._retry = this._opts.retryCount || 0;
|
|
7608
7734
|
lastPc = this._pc;
|
|
7735
|
+
pc = null;
|
|
7609
7736
|
if (!this._opts.hackCreateOfferIssue) {
|
|
7610
|
-
_context6.next =
|
|
7737
|
+
_context6.next = 9;
|
|
7611
7738
|
break;
|
|
7612
7739
|
}
|
|
7613
|
-
_context6.next =
|
|
7740
|
+
_context6.next = 9;
|
|
7614
7741
|
return this._createEmptyPeer();
|
|
7615
|
-
case
|
|
7616
|
-
_context6.prev =
|
|
7742
|
+
case 9:
|
|
7743
|
+
_context6.prev = 9;
|
|
7617
7744
|
this._firstFrameObserver.start();
|
|
7618
7745
|
if (!this._preloadPromise) {
|
|
7619
|
-
_context6.next =
|
|
7746
|
+
_context6.next = 41;
|
|
7620
7747
|
break;
|
|
7621
7748
|
}
|
|
7622
7749
|
logger.log("load()", "in preload process...");
|
|
7623
|
-
_context6.prev =
|
|
7750
|
+
_context6.prev = 13;
|
|
7624
7751
|
this._firstFrameObserver.setIsPreload(true);
|
|
7625
7752
|
if (compareURL(this._url, this._preloadPromise.url, ["tabr_start_bitrate"])) {
|
|
7626
|
-
_context6.next =
|
|
7753
|
+
_context6.next = 19;
|
|
7627
7754
|
break;
|
|
7628
7755
|
}
|
|
7629
7756
|
errorStr = "preload url not match, current url: ".concat(this._url, ", preload url: ").concat(this._preloadPromise.url);
|
|
7630
7757
|
delete this._preloadPromise;
|
|
7631
7758
|
throw new Error(errorStr);
|
|
7632
|
-
case
|
|
7759
|
+
case 19:
|
|
7760
|
+
this._loader && (this._loader.finnalUrl = this._preloadPromise.url);
|
|
7633
7761
|
preloadPromise = this._preloadPromise.promise;
|
|
7634
7762
|
delete this._preloadPromise;
|
|
7635
|
-
_context6.next =
|
|
7763
|
+
_context6.next = 24;
|
|
7636
7764
|
return preloadPromise;
|
|
7637
|
-
case
|
|
7765
|
+
case 24:
|
|
7638
7766
|
info = _context6.sent;
|
|
7639
7767
|
if (!(info.pc.signalingState !== "have-local-offer")) {
|
|
7640
|
-
_context6.next =
|
|
7768
|
+
_context6.next = 27;
|
|
7641
7769
|
break;
|
|
7642
7770
|
}
|
|
7643
7771
|
throw new Error('pc.signalingState not equal "have-local-offer", current state is '.concat(info.pc.signalingState));
|
|
7644
|
-
case
|
|
7645
|
-
|
|
7772
|
+
case 27:
|
|
7773
|
+
pc = info.pc;
|
|
7646
7774
|
answerSdp = info.answerSdp;
|
|
7647
7775
|
this._videoTransceicer = info.videoTransceiver;
|
|
7648
7776
|
this._audioTransceicer = info.audioTransceiver;
|
|
@@ -7650,48 +7778,49 @@
|
|
|
7650
7778
|
this.initVideoEncodedTransform();
|
|
7651
7779
|
this.initAudioEncodedTransform();
|
|
7652
7780
|
}
|
|
7653
|
-
_context6.next =
|
|
7781
|
+
_context6.next = 39;
|
|
7654
7782
|
break;
|
|
7655
|
-
case
|
|
7656
|
-
_context6.prev =
|
|
7657
|
-
_context6.t0 = _context6["catch"](
|
|
7783
|
+
case 34:
|
|
7784
|
+
_context6.prev = 34;
|
|
7785
|
+
_context6.t0 = _context6["catch"](13);
|
|
7658
7786
|
logger.warn("load()", "preload failed, ".concat(_context6.t0.message || _context6.t0.toString()));
|
|
7659
7787
|
this.load(url, _context6.t0.message || _context6.t0.toString());
|
|
7660
7788
|
return _context6.abrupt("return");
|
|
7661
|
-
case
|
|
7662
|
-
_context6.next =
|
|
7789
|
+
case 39:
|
|
7790
|
+
_context6.next = 47;
|
|
7663
7791
|
break;
|
|
7664
|
-
case
|
|
7792
|
+
case 41:
|
|
7665
7793
|
encodedTransformSupported = isLegacyEncodedTransformSupported();
|
|
7666
7794
|
logger.log("load()", "isLegacyEncodedTransformSupported: ".concat(encodedTransformSupported));
|
|
7667
|
-
|
|
7795
|
+
pc = new RTCPeerConnection({
|
|
7668
7796
|
encodedInsertableStreams: encodedTransformSupported && this._opts.enableSei ? true : void 0
|
|
7669
7797
|
});
|
|
7670
|
-
_context6.next =
|
|
7671
|
-
return this._getAnswerSdp(
|
|
7672
|
-
case
|
|
7798
|
+
_context6.next = 46;
|
|
7799
|
+
return this._getAnswerSdp(pc);
|
|
7800
|
+
case 46:
|
|
7673
7801
|
answerSdp = _context6.sent;
|
|
7674
|
-
case 44:
|
|
7675
|
-
this._bindRTCEvents(this._pc);
|
|
7676
|
-
_context6.next = 47;
|
|
7677
|
-
return this._handleAnswerSdp(this._pc, answerSdp);
|
|
7678
7802
|
case 47:
|
|
7803
|
+
this._bindRTCEvents(pc);
|
|
7804
|
+
_context6.next = 50;
|
|
7805
|
+
return this._handleAnswerSdp(pc, answerSdp);
|
|
7806
|
+
case 50:
|
|
7679
7807
|
if (lastPc) {
|
|
7680
7808
|
lastPc.close();
|
|
7681
7809
|
}
|
|
7682
|
-
|
|
7810
|
+
this._pc = pc;
|
|
7811
|
+
_context6.next = 57;
|
|
7683
7812
|
break;
|
|
7684
|
-
case
|
|
7685
|
-
_context6.prev =
|
|
7686
|
-
_context6.t1 = _context6["catch"](
|
|
7813
|
+
case 54:
|
|
7814
|
+
_context6.prev = 54;
|
|
7815
|
+
_context6.t1 = _context6["catch"](9);
|
|
7687
7816
|
setTimeout(function() {
|
|
7688
7817
|
return _this2._emitError(StreamingError.create(ERR.OTHER, null, _context6.t1));
|
|
7689
7818
|
});
|
|
7690
|
-
case
|
|
7819
|
+
case 57:
|
|
7691
7820
|
case "end":
|
|
7692
7821
|
return _context6.stop();
|
|
7693
7822
|
}
|
|
7694
|
-
}, _callee6, this, [[
|
|
7823
|
+
}, _callee6, this, [[9, 54], [13, 34]]);
|
|
7695
7824
|
}));
|
|
7696
7825
|
function load(_x2, _x3) {
|
|
7697
7826
|
return _load.apply(this, arguments);
|
|
@@ -7709,6 +7838,7 @@
|
|
|
7709
7838
|
value: function _bindRTCEvents(pc) {
|
|
7710
7839
|
var _this3 = this;
|
|
7711
7840
|
pc.addEventListener("track", this._onTrack);
|
|
7841
|
+
var firstConnect = true;
|
|
7712
7842
|
pc.addEventListener("connectionstatechange", function() {
|
|
7713
7843
|
logger.warn("onconnectionstatechange:", pc.connectionState);
|
|
7714
7844
|
_this3._clearPeerStateTimeout();
|
|
@@ -7716,26 +7846,31 @@
|
|
|
7716
7846
|
state: pc.connectionState,
|
|
7717
7847
|
url: _this3._url
|
|
7718
7848
|
});
|
|
7719
|
-
if (pc.connectionState === "disconnected" || pc.connectionState === "failed") {
|
|
7720
|
-
_this3.emit("waiting");
|
|
7721
|
-
_this3._stopRtcReport();
|
|
7722
|
-
}
|
|
7723
7849
|
if (pc.connectionState === "failed") {
|
|
7850
|
+
var _this3$_preAudioStats, _this3$_preVideoStats;
|
|
7851
|
+
var reason = isPositiveNumber((_this3$_preAudioStats = _this3._preAudioStats) === null || _this3$_preAudioStats === void 0 ? void 0 : _this3$_preAudioStats.bytesReceived) && !isPositiveNumber((_this3$_preVideoStats = _this3._preVideoStats) === null || _this3$_preVideoStats === void 0 ? void 0 : _this3$_preVideoStats.bytesReceived) ? "rtc connect failed(only audio)" : "rtc connect failed";
|
|
7724
7852
|
if (_this3._retry === 0) {
|
|
7725
|
-
_this3._emitError(StreamingError.network(new Error(
|
|
7853
|
+
_this3._emitError(StreamingError.network(new Error(reason)));
|
|
7726
7854
|
return;
|
|
7727
7855
|
}
|
|
7728
7856
|
_this3._retry--;
|
|
7729
|
-
_this3.load(_this3._url,
|
|
7857
|
+
_this3.load(_this3._url, reason);
|
|
7858
|
+
}
|
|
7859
|
+
if (pc.connectionState === "disconnected" || pc.connectionState === "failed") {
|
|
7860
|
+
_this3.emit("waiting");
|
|
7861
|
+
_this3._stopRtcReport();
|
|
7730
7862
|
}
|
|
7731
7863
|
if (pc.connectionState === "connected") {
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7864
|
+
if (firstConnect) {
|
|
7865
|
+
firstConnect = false;
|
|
7866
|
+
_this3._handleMediaStream();
|
|
7867
|
+
_this3.emit(EVENT.TTFB, {
|
|
7868
|
+
url: _this3._url,
|
|
7869
|
+
responseUrl: _this3._url,
|
|
7870
|
+
elapsed: Date.now() - _this3._rctConnectStartTs
|
|
7871
|
+
});
|
|
7872
|
+
_this3._checkStatsError();
|
|
7873
|
+
}
|
|
7739
7874
|
_this3._startRtcReport();
|
|
7740
7875
|
}
|
|
7741
7876
|
});
|
|
@@ -7828,6 +7963,7 @@
|
|
|
7828
7963
|
key: "_getAnswerSdp",
|
|
7829
7964
|
value: function() {
|
|
7830
7965
|
var _getAnswerSdp2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee7(pc) {
|
|
7966
|
+
var _this6 = this, _this$_opts$standardi;
|
|
7831
7967
|
var offer, answerSdp, parsed, finnalUrl, _this$_opts, _this$_loader, _this$_opts2, _parsed$media, parseSession, sessionId, reqStart, res, answer, err;
|
|
7832
7968
|
return _regeneratorRuntime$1().wrap(function _callee7$(_context7) {
|
|
7833
7969
|
while (1)
|
|
@@ -7879,31 +8015,38 @@
|
|
|
7879
8015
|
parsed.media.filter(function(x) {
|
|
7880
8016
|
return x.type === "audio";
|
|
7881
8017
|
}).forEach(function(x) {
|
|
7882
|
-
var _x$rtp$filter$,
|
|
8018
|
+
var _x$rtp$filter$, _this6$_opts$standard, _this6$_opts$standard2;
|
|
7883
8019
|
var opusPayload = (_x$rtp$filter$ = x.rtp.filter(function(rtp) {
|
|
7884
8020
|
return rtp.codec === "opus";
|
|
7885
8021
|
})[0]) === null || _x$rtp$filter$ === void 0 ? void 0 : _x$rtp$filter$.payload;
|
|
7886
8022
|
if (!opusPayload)
|
|
7887
8023
|
return;
|
|
7888
|
-
|
|
7889
|
-
|
|
7890
|
-
|
|
7891
|
-
|
|
7892
|
-
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
8024
|
+
if ((_this6$_opts$standard = _this6._opts.standardizeKillSwitch) !== null && _this6$_opts$standard !== void 0 && _this6$_opts$standard.sld_fmtp_opus) {
|
|
8025
|
+
x.fmtp.forEach(function(fmtp) {
|
|
8026
|
+
if (fmtp.payload !== opusPayload)
|
|
8027
|
+
return;
|
|
8028
|
+
fmtp.config = "minptime=10;stereo=1;useinbandfec=1";
|
|
8029
|
+
});
|
|
8030
|
+
}
|
|
8031
|
+
if ((_this6$_opts$standard2 = _this6._opts.standardizeKillSwitch) !== null && _this6$_opts$standard2 !== void 0 && _this6$_opts$standard2.sld_rtcpfb_opus_nack) {
|
|
8032
|
+
var _x$rtcpFb;
|
|
8033
|
+
(_x$rtcpFb = x.rtcpFb) === null || _x$rtcpFb === void 0 ? void 0 : _x$rtcpFb.push({
|
|
8034
|
+
payload: opusPayload,
|
|
8035
|
+
type: "nack"
|
|
8036
|
+
});
|
|
8037
|
+
}
|
|
7897
8038
|
});
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
7902
|
-
|
|
7903
|
-
x2.config
|
|
7904
|
-
|
|
8039
|
+
if ((_this$_opts$standardi = this._opts.standardizeKillSwitch) !== null && _this$_opts$standardi !== void 0 && _this$_opts$standardi.sld_fmtp_sps_pps) {
|
|
8040
|
+
parsed.media.filter(function(x) {
|
|
8041
|
+
return x.type === "video";
|
|
8042
|
+
}).forEach(function(x) {
|
|
8043
|
+
x.fmtp.forEach(function(x2) {
|
|
8044
|
+
if (x2.config.indexOf("profile-level-id") !== -1) {
|
|
8045
|
+
x2.config = "".concat(x2.config, ";sps-pps-idr-in-keyframe=1");
|
|
8046
|
+
}
|
|
8047
|
+
});
|
|
7905
8048
|
});
|
|
7906
|
-
}
|
|
8049
|
+
}
|
|
7907
8050
|
offer.sdp = lib.write(parsed);
|
|
7908
8051
|
logger.log("local offer modified:\n", offer);
|
|
7909
8052
|
_context7.next = 25;
|
|
@@ -8038,7 +8181,7 @@
|
|
|
8038
8181
|
this._firstFrameObserver.changeFirstFrameState(RTC_FIRST_FRAME_STATE.ANSWER_SDP_READY);
|
|
8039
8182
|
this._networkEvaluate = new NetworkEvaluate(pc, this._opts.networkEvaluateInterval);
|
|
8040
8183
|
this._listenPeerStateTimeout();
|
|
8041
|
-
this._firstFrameObserver.bindEvents(pc, this._videoTransceicer, this._media);
|
|
8184
|
+
this._firstFrameObserver.bindEvents(pc, this._videoTransceicer, this._audioTransceicer, this._media);
|
|
8042
8185
|
case 17:
|
|
8043
8186
|
case "end":
|
|
8044
8187
|
return _context8.stop();
|
|
@@ -8053,11 +8196,11 @@
|
|
|
8053
8196
|
}, {
|
|
8054
8197
|
key: "_listenPeerStateTimeout",
|
|
8055
8198
|
value: function _listenPeerStateTimeout() {
|
|
8056
|
-
var
|
|
8199
|
+
var _this7 = this;
|
|
8057
8200
|
this._clearPeerStateTimeout();
|
|
8058
8201
|
if (this._opts.connectionStateChangeTimeout) {
|
|
8059
8202
|
this._peerStateTimer = setTimeout(function() {
|
|
8060
|
-
|
|
8203
|
+
_this7._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_SRC_NOT_SUPPORTED, {
|
|
8061
8204
|
message: "listen connectionstatechange timeout"
|
|
8062
8205
|
}));
|
|
8063
8206
|
}, this._opts.connectionStateChangeTimeout);
|
|
@@ -8074,59 +8217,59 @@
|
|
|
8074
8217
|
}, {
|
|
8075
8218
|
key: "_startRtcReport",
|
|
8076
8219
|
value: function _startRtcReport() {
|
|
8077
|
-
var
|
|
8220
|
+
var _this8 = this;
|
|
8078
8221
|
this._stopRtcReport();
|
|
8079
8222
|
var report = /* @__PURE__ */ function() {
|
|
8080
8223
|
var _ref5 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee9() {
|
|
8081
|
-
var
|
|
8082
|
-
var
|
|
8224
|
+
var _this8$_audioTranscei, _this8$_audioTranscei2, _this8$_videoTranscei, _this8$_videoTranscei2;
|
|
8225
|
+
var _this8$_frameRecvCall, _yield$Promise$all3, _yield$Promise$all4, curAudioStats, curVideoStats, _this8$_audioStallObs, _this8$_videoStallObs, _this8$_networkQualit, _this8$_networkQualit2, _this8$_media, _this8$_media2, _this8$_media3, _this8$_media4, _this8$_media5, _this8$_media6, _this8$_frameRecvCall2, audioStats, videoStats, audioStallInfo, videoStallInfo, _ref6, _ref7, quality, qualityInfo, av_sync_diff;
|
|
8083
8226
|
return _regeneratorRuntime$1().wrap(function _callee9$(_context9) {
|
|
8084
8227
|
while (1)
|
|
8085
8228
|
switch (_context9.prev = _context9.next) {
|
|
8086
8229
|
case 0:
|
|
8087
|
-
if (!(!((
|
|
8230
|
+
if (!(!((_this8$_audioTranscei = _this8._audioTransceicer) !== null && _this8$_audioTranscei !== void 0 && (_this8$_audioTranscei2 = _this8$_audioTranscei.receiver) !== null && _this8$_audioTranscei2 !== void 0 && _this8$_audioTranscei2.getStats) || !((_this8$_videoTranscei = _this8._videoTransceicer) !== null && _this8$_videoTranscei !== void 0 && (_this8$_videoTranscei2 = _this8$_videoTranscei.receiver) !== null && _this8$_videoTranscei2 !== void 0 && _this8$_videoTranscei2.getStats))) {
|
|
8088
8231
|
_context9.next = 4;
|
|
8089
8232
|
break;
|
|
8090
8233
|
}
|
|
8091
|
-
|
|
8092
|
-
|
|
8234
|
+
_this8._preAudioStats = null;
|
|
8235
|
+
_this8._preVideoStats = null;
|
|
8093
8236
|
return _context9.abrupt("return");
|
|
8094
8237
|
case 4:
|
|
8095
|
-
if (!
|
|
8096
|
-
|
|
8097
|
-
|
|
8238
|
+
if (!_this8._audioStallObserver && _this8._audioTransceicer) {
|
|
8239
|
+
_this8._audioStallObserver = new AudioStallObserver();
|
|
8240
|
+
_this8._audioStallObserver.start(_this8._audioTransceicer);
|
|
8098
8241
|
}
|
|
8099
|
-
if (!
|
|
8100
|
-
|
|
8101
|
-
|
|
8242
|
+
if (!_this8._videoStallObserver && _this8._video && _this8._media) {
|
|
8243
|
+
_this8._videoStallObserver = new VideoStallObserver();
|
|
8244
|
+
_this8._videoStallObserver.start(_this8._media);
|
|
8102
8245
|
}
|
|
8103
|
-
if (!
|
|
8104
|
-
|
|
8105
|
-
(
|
|
8246
|
+
if (!_this8._frameRecvCallback && _this8._media) {
|
|
8247
|
+
_this8._frameRecvCallback = new VideoFrameRecvCallback();
|
|
8248
|
+
(_this8$_frameRecvCall = _this8._frameRecvCallback) === null || _this8$_frameRecvCall === void 0 ? void 0 : _this8$_frameRecvCall.start(_this8._media);
|
|
8106
8249
|
}
|
|
8107
|
-
if (
|
|
8108
|
-
|
|
8250
|
+
if (_this8._pc && !_this8._networkQuality && _this8._opts.enableNetworkQuality && _this8._opts.networkQuality) {
|
|
8251
|
+
_this8._networkQuality = new NetworkQuality(_this8._pc, _this8._opts.networkQuality);
|
|
8109
8252
|
}
|
|
8110
8253
|
_context9.next = 10;
|
|
8111
|
-
return Promise.all([getRecvAudioStats(
|
|
8254
|
+
return Promise.all([getRecvAudioStats(_this8._audioTransceicer.receiver.getStats()), getRecvVideoStats(_this8._videoTransceicer.receiver.getStats())]);
|
|
8112
8255
|
case 10:
|
|
8113
8256
|
_yield$Promise$all3 = _context9.sent;
|
|
8114
8257
|
_yield$Promise$all4 = _slicedToArray(_yield$Promise$all3, 2);
|
|
8115
8258
|
curAudioStats = _yield$Promise$all4[0];
|
|
8116
8259
|
curVideoStats = _yield$Promise$all4[1];
|
|
8117
|
-
if (!(
|
|
8260
|
+
if (!(_this8._preAudioStats && _this8._preVideoStats)) {
|
|
8118
8261
|
_context9.next = 28;
|
|
8119
8262
|
break;
|
|
8120
8263
|
}
|
|
8121
|
-
audioStats = diffRecvAudioStats(
|
|
8122
|
-
videoStats = diffRecvVideoStats(
|
|
8123
|
-
|
|
8264
|
+
audioStats = diffRecvAudioStats(_this8._preAudioStats, curAudioStats);
|
|
8265
|
+
videoStats = diffRecvVideoStats(_this8._preVideoStats, curVideoStats);
|
|
8266
|
+
_this8._videoJitterBufferDelay = videoStats.jitterBufferDelay;
|
|
8124
8267
|
_context9.next = 20;
|
|
8125
|
-
return (
|
|
8268
|
+
return (_this8$_audioStallObs = _this8._audioStallObserver) === null || _this8$_audioStallObs === void 0 ? void 0 : _this8$_audioStallObs.getAudioStallInfo();
|
|
8126
8269
|
case 20:
|
|
8127
8270
|
audioStallInfo = _context9.sent;
|
|
8128
8271
|
_context9.next = 23;
|
|
8129
|
-
return (
|
|
8272
|
+
return (_this8$_videoStallObs = _this8._videoStallObserver) === null || _this8$_videoStallObs === void 0 ? void 0 : _this8$_videoStallObs.getStallInfo({
|
|
8130
8273
|
interval: videoStats.statsInterval,
|
|
8131
8274
|
frameRateReceived: videoStats.receivedFrameRate,
|
|
8132
8275
|
frameRateDecoded: videoStats.decoderOutputFrameRate,
|
|
@@ -8134,18 +8277,18 @@
|
|
|
8134
8277
|
});
|
|
8135
8278
|
case 23:
|
|
8136
8279
|
videoStallInfo = _context9.sent;
|
|
8137
|
-
_ref6 = (
|
|
8280
|
+
_ref6 = (_this8$_networkQualit = (_this8$_networkQualit2 = _this8._networkQuality) === null || _this8$_networkQualit2 === void 0 ? void 0 : _this8$_networkQualit2.getDownlinkQuality(_objectSpread2$2(_objectSpread2$2({}, audioStats), {}, {
|
|
8138
8281
|
stallDuration: (audioStallInfo === null || audioStallInfo === void 0 ? void 0 : audioStallInfo.stallDuration) || 0
|
|
8139
8282
|
}), _objectSpread2$2(_objectSpread2$2({}, videoStats), {}, {
|
|
8140
8283
|
stallDuration: (videoStallInfo === null || videoStallInfo === void 0 ? void 0 : videoStallInfo.stall.stallDuration100ms) || (videoStallInfo === null || videoStallInfo === void 0 ? void 0 : videoStallInfo.stall.stallDuration500ms) || 0
|
|
8141
|
-
}))) !== null &&
|
|
8142
|
-
if (
|
|
8143
|
-
|
|
8284
|
+
}))) !== null && _this8$_networkQualit !== void 0 ? _this8$_networkQualit : [], _ref7 = _slicedToArray(_ref6, 2), quality = _ref7[0], qualityInfo = _ref7[1];
|
|
8285
|
+
if (_this8._opts.enableAdaptiveJitterBuffer) {
|
|
8286
|
+
_this8._handleJitterBuffer(qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos, _this8._opts.adaptiveJitterBuffer, _this8._opts.networkStrategy);
|
|
8144
8287
|
}
|
|
8145
8288
|
if (videoStats.estimatedPlayoutTimestamp && audioStats.estimatedPlayoutTimestamp) {
|
|
8146
8289
|
av_sync_diff = videoStats.estimatedPlayoutTimestamp - audioStats.estimatedPlayoutTimestamp;
|
|
8147
8290
|
}
|
|
8148
|
-
|
|
8291
|
+
_this8.emit(EXTEND_EVENTS.RTC_NETWORK, _objectSpread2$2({
|
|
8149
8292
|
interval: videoStats.statsInterval,
|
|
8150
8293
|
network_quality: quality,
|
|
8151
8294
|
audio_stall_duration: audioStallInfo === null || audioStallInfo === void 0 ? void 0 : audioStallInfo.stallDuration,
|
|
@@ -8171,13 +8314,13 @@
|
|
|
8171
8314
|
quality_qos: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos,
|
|
8172
8315
|
quality_audio_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.audioQoe,
|
|
8173
8316
|
quality_video_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.videoQoe,
|
|
8174
|
-
current_delay:
|
|
8317
|
+
current_delay: _this8._getDelay(),
|
|
8175
8318
|
visibility_state: document.visibilityState,
|
|
8176
|
-
target_delay:
|
|
8319
|
+
target_delay: _this8._targetDelayHint,
|
|
8177
8320
|
av_sync_diff,
|
|
8178
|
-
set_delay_error:
|
|
8179
|
-
video_width: ((
|
|
8180
|
-
video_height: ((
|
|
8321
|
+
set_delay_error: _this8._setDelayError || null,
|
|
8322
|
+
video_width: ((_this8$_media = _this8._media) === null || _this8$_media === void 0 ? void 0 : _this8$_media.videoWidth) || 0,
|
|
8323
|
+
video_height: ((_this8$_media2 = _this8._media) === null || _this8$_media2 === void 0 ? void 0 : _this8$_media2.videoHeight) || 0,
|
|
8181
8324
|
abr_state: videoStats.abrState || "none",
|
|
8182
8325
|
recv_frame_rate: videoStats.receivedFrameRate,
|
|
8183
8326
|
decode_frame_rate: videoStats.decoderOutputFrameRate,
|
|
@@ -8185,15 +8328,19 @@
|
|
|
8185
8328
|
drop_frame_rate: videoStats.framesDropped,
|
|
8186
8329
|
audio_packets_received: audioStats.packetsReceived,
|
|
8187
8330
|
video_packets_received: videoStats.packetsReceived,
|
|
8188
|
-
video_muted: (
|
|
8189
|
-
video_paused: (
|
|
8190
|
-
video_volume: (
|
|
8191
|
-
video_current_time: (
|
|
8192
|
-
|
|
8331
|
+
video_muted: (_this8$_media3 = _this8._media) === null || _this8$_media3 === void 0 ? void 0 : _this8$_media3.muted,
|
|
8332
|
+
video_paused: (_this8$_media4 = _this8._media) === null || _this8$_media4 === void 0 ? void 0 : _this8$_media4.paused,
|
|
8333
|
+
video_volume: (_this8$_media5 = _this8._media) === null || _this8$_media5 === void 0 ? void 0 : _this8$_media5.volume,
|
|
8334
|
+
video_current_time: (_this8$_media6 = _this8._media) === null || _this8$_media6 === void 0 ? void 0 : _this8$_media6.currentTime,
|
|
8335
|
+
fec_packets_received: videoStats.fecPacketsReceived,
|
|
8336
|
+
video_kbps: videoStats.receivedKBitrate,
|
|
8337
|
+
audio_kbps: audioStats.receivedKBitrate,
|
|
8338
|
+
fec_ssrc: videoStats.fecSsrc
|
|
8339
|
+
}, ((_this8$_frameRecvCall2 = _this8._frameRecvCallback) === null || _this8$_frameRecvCall2 === void 0 ? void 0 : _this8$_frameRecvCall2.getRecentRenderInfo4Report()) || {}));
|
|
8193
8340
|
case 28:
|
|
8194
|
-
|
|
8195
|
-
|
|
8196
|
-
|
|
8341
|
+
_this8._preAudioStats = curAudioStats;
|
|
8342
|
+
_this8._preVideoStats = curVideoStats;
|
|
8343
|
+
_this8._setDelayError = null;
|
|
8197
8344
|
case 31:
|
|
8198
8345
|
case "end":
|
|
8199
8346
|
return _context9.stop();
|
|
@@ -8306,6 +8453,7 @@
|
|
|
8306
8453
|
this._firstFrameObserver.reset();
|
|
8307
8454
|
this.emit(EVENT.ERROR, error);
|
|
8308
8455
|
clearTimeout(this._checkStatsErrorTimer);
|
|
8456
|
+
this._stopRtcReport();
|
|
8309
8457
|
this._clearPeerStateTimeout();
|
|
8310
8458
|
if (this._pc) {
|
|
8311
8459
|
this._pc.close();
|
|
@@ -8347,7 +8495,7 @@
|
|
|
8347
8495
|
}, {
|
|
8348
8496
|
key: "_changeVolumeInHarmonyWorkaround",
|
|
8349
8497
|
value: function _changeVolumeInHarmonyWorkaround() {
|
|
8350
|
-
var
|
|
8498
|
+
var _this9 = this;
|
|
8351
8499
|
if (isHarmonyOS()) {
|
|
8352
8500
|
var originalDescriptor = Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, "muted");
|
|
8353
8501
|
if (this._media && originalDescriptor) {
|
|
@@ -8366,9 +8514,9 @@
|
|
|
8366
8514
|
}
|
|
8367
8515
|
});
|
|
8368
8516
|
this._revertVolumeWorkaround = function() {
|
|
8369
|
-
logger.log("revert HarmonyOS muted workaround. video dom:",
|
|
8370
|
-
if (
|
|
8371
|
-
Object.defineProperty(
|
|
8517
|
+
logger.log("revert HarmonyOS muted workaround. video dom:", _this9._media);
|
|
8518
|
+
if (_this9._media) {
|
|
8519
|
+
Object.defineProperty(_this9._media, "muted", originalDescriptor);
|
|
8372
8520
|
}
|
|
8373
8521
|
};
|
|
8374
8522
|
}
|
|
@@ -8377,7 +8525,7 @@
|
|
|
8377
8525
|
}, {
|
|
8378
8526
|
key: "_mutedBeforePlayingWorkaround",
|
|
8379
8527
|
value: function _mutedBeforePlayingWorkaround() {
|
|
8380
|
-
var
|
|
8528
|
+
var _this10 = this;
|
|
8381
8529
|
if (isHeyTapBrowser() || isVivoBrowser()) {
|
|
8382
8530
|
var originalDescriptor = Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, "muted");
|
|
8383
8531
|
if (this._media && originalDescriptor) {
|
|
@@ -8397,10 +8545,10 @@
|
|
|
8397
8545
|
});
|
|
8398
8546
|
var revertMutedProxy = function revertMutedProxy2() {
|
|
8399
8547
|
logger.log("revert muted workaround. muted:", originalMuted);
|
|
8400
|
-
if (
|
|
8401
|
-
Object.defineProperty(
|
|
8402
|
-
|
|
8403
|
-
|
|
8548
|
+
if (_this10._media) {
|
|
8549
|
+
Object.defineProperty(_this10._media, "muted", originalDescriptor);
|
|
8550
|
+
_this10._media.muted = originalMuted;
|
|
8551
|
+
_this10._media.removeEventListener("playing", revertMutedProxy2);
|
|
8404
8552
|
}
|
|
8405
8553
|
};
|
|
8406
8554
|
this._media.addEventListener("playing", revertMutedProxy);
|
|
@@ -8510,10 +8658,11 @@
|
|
|
8510
8658
|
_this.__retry = function() {
|
|
8511
8659
|
_this.player.removeClass(STATE_CLASS.ERROR);
|
|
8512
8660
|
_this.player.addClass(STATE_CLASS.LOADING);
|
|
8513
|
-
runHooks(_assertThisInitialized$1(_this), "retry", function() {
|
|
8661
|
+
_this.player.runHooks(_assertThisInitialized$1(_this), "retry", function() {
|
|
8514
8662
|
_this.player.src = "";
|
|
8515
8663
|
_this.player.once(CANPLAY, function() {
|
|
8516
|
-
|
|
8664
|
+
var _assertThisInitialize, _assertThisInitialize2;
|
|
8665
|
+
(_assertThisInitialize = _assertThisInitialized$1(_this)) === null || _assertThisInitialize === void 0 ? void 0 : (_assertThisInitialize2 = _assertThisInitialize.player) === null || _assertThisInitialize2 === void 0 ? void 0 : _assertThisInitialize2.mediaPlay();
|
|
8517
8666
|
});
|
|
8518
8667
|
});
|
|
8519
8668
|
};
|
|
@@ -8565,7 +8714,7 @@
|
|
|
8565
8714
|
}, {
|
|
8566
8715
|
key: "version",
|
|
8567
8716
|
get: function get() {
|
|
8568
|
-
return "0.2.1-alpha.
|
|
8717
|
+
return "0.2.1-alpha.61";
|
|
8569
8718
|
}
|
|
8570
8719
|
}, {
|
|
8571
8720
|
key: "beforePlayerInit",
|