@volcengine/veplayer-plugin 2.12.0-rc.0 → 2.12.0-rc.2
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 +537 -246
- package/esm/index.production.js +3 -3
- package/esm/veplayer.plugin.abr.development.js +3 -1
- package/esm/veplayer.plugin.abr.production.js +1 -1
- package/esm/veplayer.plugin.ad.development.js +18 -4
- package/esm/veplayer.plugin.ad.production.js +2 -2
- package/esm/veplayer.plugin.drm.development.js +3 -1
- package/esm/veplayer.plugin.drm.production.js +1 -1
- package/esm/veplayer.plugin.flv.development.js +5 -3
- package/esm/veplayer.plugin.flv.production.js +1 -1
- package/esm/veplayer.plugin.hls.development.js +64 -14
- package/esm/veplayer.plugin.hls.production.js +1 -1
- package/esm/veplayer.plugin.hlsjs.development.js +3 -1
- package/esm/veplayer.plugin.hlsjs.production.js +1 -1
- package/esm/veplayer.plugin.mp4.development.js +9 -3
- package/esm/veplayer.plugin.mp4.production.js +1 -1
- package/esm/veplayer.plugin.rtm.development.js +293 -151
- package/esm/veplayer.plugin.rtm.production.js +1 -1
- package/esm/veplayer.plugin.shaka.development.js +8 -2
- package/esm/veplayer.plugin.shaka.production.js +2 -2
- package/esm/veplayer.strategy.base.development.js +163 -78
- package/esm/veplayer.strategy.base.production.js +1 -1
- package/package.json +1 -1
- package/umd/veplayer.plugin.abr.development.js +3 -1
- package/umd/veplayer.plugin.abr.production.js +1 -1
- package/umd/veplayer.plugin.ad.development.js +18 -4
- package/umd/veplayer.plugin.ad.production.js +1 -1
- package/umd/veplayer.plugin.drm.development.js +3 -1
- package/umd/veplayer.plugin.drm.production.js +1 -1
- package/umd/veplayer.plugin.flv.development.js +5 -3
- package/umd/veplayer.plugin.flv.production.js +1 -1
- package/umd/veplayer.plugin.hls.development.js +64 -14
- package/umd/veplayer.plugin.hls.production.js +1 -1
- package/umd/veplayer.plugin.hlsjs.development.js +3 -1
- package/umd/veplayer.plugin.hlsjs.production.js +1 -1
- package/umd/veplayer.plugin.mp4.development.js +9 -3
- package/umd/veplayer.plugin.mp4.production.js +1 -1
- package/umd/veplayer.plugin.rtm.development.js +293 -151
- package/umd/veplayer.plugin.rtm.production.js +1 -1
- package/umd/veplayer.plugin.shaka.development.js +8 -2
- package/umd/veplayer.plugin.shaka.production.js +1 -1
- package/umd/veplayer.strategy.base.development.js +163 -78
- package/umd/veplayer.strategy.base.production.js +1 -1
|
@@ -1687,7 +1687,7 @@ util.getCurrentTimeByOffset = function(offsetTime, segments) {
|
|
|
1687
1687
|
}
|
|
1688
1688
|
return offsetTime;
|
|
1689
1689
|
};
|
|
1690
|
-
var version = "3.0.
|
|
1690
|
+
var version = "3.0.24-rc.6";
|
|
1691
1691
|
var ERROR_MAP = {
|
|
1692
1692
|
1: 5101,
|
|
1693
1693
|
2: 5102,
|
|
@@ -1798,7 +1798,7 @@ function hook(hookName, handler) {
|
|
|
1798
1798
|
}
|
|
1799
1799
|
if (this.__hooks && this.__hooks[hookName]) {
|
|
1800
1800
|
try {
|
|
1801
|
-
var preRet = runHooks(this, hookName, handler);
|
|
1801
|
+
var preRet = runHooks.apply(void 0, [this, hookName, handler].concat(Array.prototype.slice.call(arguments)));
|
|
1802
1802
|
if (preRet) {
|
|
1803
1803
|
if (preRet.then) {
|
|
1804
1804
|
preRet.then(function(isContinue) {
|
|
@@ -1912,6 +1912,8 @@ function runHooks(obj, hookName, handler) {
|
|
|
1912
1912
|
});
|
|
1913
1913
|
} else if (ret !== false) {
|
|
1914
1914
|
return runHooksRecursive2.apply(void 0, [obj2, hookName2, handler2].concat(args2));
|
|
1915
|
+
} else if (ret === false) {
|
|
1916
|
+
return false;
|
|
1915
1917
|
}
|
|
1916
1918
|
};
|
|
1917
1919
|
return runHooksRecursive.apply(void 0, [obj, hookName, handler].concat(args));
|
|
@@ -5078,9 +5080,9 @@ lib.parsePayloads = parser.parsePayloads;
|
|
|
5078
5080
|
lib.parseRemoteCandidates = parser.parseRemoteCandidates;
|
|
5079
5081
|
lib.parseImageAttributes = parser.parseImageAttributes;
|
|
5080
5082
|
lib.parseSimulcastStreamList = parser.parseSimulcastStreamList;
|
|
5081
|
-
var _excluded = ["adaptiveJitterBuffer"];
|
|
5083
|
+
var _excluded = ["adaptiveJitterBuffer", "standardizeKillSwitch"];
|
|
5082
5084
|
function getOption(options) {
|
|
5083
|
-
var _ref = options || {}, _ref$adaptiveJitterBu = _ref.adaptiveJitterBuffer, adaptiveJitterBuffer = _ref$adaptiveJitterBu === void 0 ? {} : _ref$adaptiveJitterBu, opts = _objectWithoutProperties$1(_ref, _excluded);
|
|
5085
|
+
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);
|
|
5084
5086
|
return _objectSpread2$2({
|
|
5085
5087
|
retryCount: 0,
|
|
5086
5088
|
retryDelay: 1e3,
|
|
@@ -5151,7 +5153,12 @@ function getOption(options) {
|
|
|
5151
5153
|
5: {
|
|
5152
5154
|
jitterBuffer: 3
|
|
5153
5155
|
}
|
|
5154
|
-
}
|
|
5156
|
+
},
|
|
5157
|
+
standardizeKillSwitch: _objectSpread2$2({
|
|
5158
|
+
sld_fmtp_opus: true,
|
|
5159
|
+
sld_rtcpfb_opus_nack: true,
|
|
5160
|
+
sld_fmtp_sps_pps: true
|
|
5161
|
+
}, standardizeKillSwitch)
|
|
5155
5162
|
}, opts);
|
|
5156
5163
|
}
|
|
5157
5164
|
function _getStats(stats) {
|
|
@@ -5493,7 +5500,7 @@ function getCapacity() {
|
|
|
5493
5500
|
});
|
|
5494
5501
|
}
|
|
5495
5502
|
var isEncodedTransformSupported = function isEncodedTransformSupported2() {
|
|
5496
|
-
return typeof TransformStream !== "undefined" && typeof RTCRtpSender !== "undefined" && typeof RTCRtpReceiver !== "undefined" && typeof RTCRtpScriptTransform !== "undefined" && "transform" in RTCRtpSender.prototype && "transform" in RTCRtpReceiver.prototype && isWorkerSupported() && isMessageChannelSupported();
|
|
5503
|
+
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();
|
|
5497
5504
|
};
|
|
5498
5505
|
var isWorkerSupported = function isWorkerSupported2() {
|
|
5499
5506
|
return typeof window !== "undefined" && window.Worker;
|
|
@@ -5502,7 +5509,7 @@ var isMessageChannelSupported = function isMessageChannelSupported2() {
|
|
|
5502
5509
|
return typeof MessageChannel !== "undefined";
|
|
5503
5510
|
};
|
|
5504
5511
|
var isLegacyEncodedTransformSupported = function isLegacyEncodedTransformSupported2() {
|
|
5505
|
-
return typeof TransformStream !== "undefined" && typeof RTCRtpSender !== "undefined" && typeof RTCRtpReceiver !== "undefined" && typeof RTCRtpSender.prototype.createEncodedStreams !== "undefined" && typeof RTCRtpReceiver.prototype.createEncodedStreams !== "undefined";
|
|
5512
|
+
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";
|
|
5506
5513
|
};
|
|
5507
5514
|
var Nalunit = {
|
|
5508
5515
|
getNALUnits: function getNALUnits(buffer) {
|
|
@@ -6680,6 +6687,8 @@ function _getRecvVideoStats() {
|
|
|
6680
6687
|
currentStats.firCount = stat.firCount;
|
|
6681
6688
|
currentStats.nackCount = stat.nackCount;
|
|
6682
6689
|
currentStats.pliCount = stat.pliCount;
|
|
6690
|
+
currentStats.fecPacketsReceived = stat.fecPacketsReceived;
|
|
6691
|
+
currentStats.fecSsrc = stat.fecSsrc;
|
|
6683
6692
|
if (stat.jitterBufferDelay !== void 0) {
|
|
6684
6693
|
currentStats.jitterBufferEmittedCount = stat.jitterBufferEmittedCount;
|
|
6685
6694
|
currentStats.jitterBufferDelay = stat.jitterBufferDelay;
|
|
@@ -6744,12 +6753,14 @@ function diffRecvVideoStats(oldStats, newStats) {
|
|
|
6744
6753
|
nackCount,
|
|
6745
6754
|
pliCount: diffNumber(oldStats, newStats, "pliCount"),
|
|
6746
6755
|
e2eDelay: Math.round((newStats.rtt || 0) + jitterBufferDelay),
|
|
6747
|
-
retransmittedRate: +(nackCount / (packetsReceived + packetsLostDiff)).toFixed(2)
|
|
6756
|
+
retransmittedRate: +(nackCount / (packetsReceived + packetsLostDiff)).toFixed(2),
|
|
6757
|
+
fecPacketsReceived: diffNumber(oldStats, newStats, "fecPacketsReceived"),
|
|
6758
|
+
fecSsrc: newStats.fecSsrc
|
|
6748
6759
|
};
|
|
6749
6760
|
}
|
|
6750
6761
|
function diffNumber(oldValue, newValue, key) {
|
|
6751
|
-
var oldV = Number.
|
|
6752
|
-
var newV = Number.
|
|
6762
|
+
var oldV = !Number.isFinite(oldValue[key]) ? 0 : +oldValue[key];
|
|
6763
|
+
var newV = !Number.isFinite(newValue[key]) ? 0 : +newValue[key];
|
|
6753
6764
|
return Math.max(0, newV - oldV);
|
|
6754
6765
|
}
|
|
6755
6766
|
var QoELevel = {
|
|
@@ -6880,6 +6891,63 @@ var NetworkQuality = /* @__PURE__ */ function() {
|
|
|
6880
6891
|
}]);
|
|
6881
6892
|
return NetworkQuality2;
|
|
6882
6893
|
}();
|
|
6894
|
+
var gpuInfo;
|
|
6895
|
+
function getGpuInfo() {
|
|
6896
|
+
if (!gpuInfo) {
|
|
6897
|
+
gpuInfo = _getGpuInfo();
|
|
6898
|
+
}
|
|
6899
|
+
return gpuInfo;
|
|
6900
|
+
}
|
|
6901
|
+
function _getGpuInfo() {
|
|
6902
|
+
var canvas = document.createElement("canvas");
|
|
6903
|
+
var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl");
|
|
6904
|
+
if (!gl) {
|
|
6905
|
+
return {
|
|
6906
|
+
renderer: "unknown(WebGLRenderingContext not existed)",
|
|
6907
|
+
vendor: "unknown(WebGLRenderingContext not existed)"
|
|
6908
|
+
};
|
|
6909
|
+
}
|
|
6910
|
+
var info = gl.getExtension("WEBGL_debug_renderer_info");
|
|
6911
|
+
if (!info) {
|
|
6912
|
+
return {
|
|
6913
|
+
renderer: "unknown(info not existed)",
|
|
6914
|
+
vendor: "unknown(info not existed)"
|
|
6915
|
+
};
|
|
6916
|
+
}
|
|
6917
|
+
var renderer = gl.getParameter(info.UNMASKED_RENDERER_WEBGL);
|
|
6918
|
+
var vendor = gl.getParameter(info.UNMASKED_VENDOR_WEBGL);
|
|
6919
|
+
if (canvas && canvas.parentNode) {
|
|
6920
|
+
canvas.parentNode.removeChild(canvas);
|
|
6921
|
+
}
|
|
6922
|
+
canvas = void 0;
|
|
6923
|
+
gl = void 0;
|
|
6924
|
+
return {
|
|
6925
|
+
renderer,
|
|
6926
|
+
vendor
|
|
6927
|
+
};
|
|
6928
|
+
}
|
|
6929
|
+
function extractProfileInfo(sdpFmtpLine) {
|
|
6930
|
+
var profileLevelId = "";
|
|
6931
|
+
if (!sdpFmtpLine) {
|
|
6932
|
+
return profileLevelId;
|
|
6933
|
+
}
|
|
6934
|
+
var paramArray = sdpFmtpLine.split(";");
|
|
6935
|
+
var _iterator = _createForOfIteratorHelper$1(paramArray), _step;
|
|
6936
|
+
try {
|
|
6937
|
+
for (_iterator.s(); !(_step = _iterator.n()).done; ) {
|
|
6938
|
+
var param = _step.value;
|
|
6939
|
+
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];
|
|
6940
|
+
if (key === "profile-level-id") {
|
|
6941
|
+
profileLevelId = value;
|
|
6942
|
+
}
|
|
6943
|
+
}
|
|
6944
|
+
} catch (err) {
|
|
6945
|
+
_iterator.e(err);
|
|
6946
|
+
} finally {
|
|
6947
|
+
_iterator.f();
|
|
6948
|
+
}
|
|
6949
|
+
return profileLevelId;
|
|
6950
|
+
}
|
|
6883
6951
|
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];
|
|
6884
6952
|
var FirstFrameObserver = /* @__PURE__ */ function() {
|
|
6885
6953
|
function FirstFrameObserver2(_emitFirstFrameState) {
|
|
@@ -6893,6 +6961,7 @@ var FirstFrameObserver = /* @__PURE__ */ function() {
|
|
|
6893
6961
|
this._pc = null;
|
|
6894
6962
|
this._video = null;
|
|
6895
6963
|
this._videoTransceiver = null;
|
|
6964
|
+
this._audioTransceiver = null;
|
|
6896
6965
|
this._extraInfo = {
|
|
6897
6966
|
is_preload: false
|
|
6898
6967
|
};
|
|
@@ -6965,11 +7034,12 @@ var FirstFrameObserver = /* @__PURE__ */ function() {
|
|
|
6965
7034
|
}
|
|
6966
7035
|
}, {
|
|
6967
7036
|
key: "bindEvents",
|
|
6968
|
-
value: function bindEvents(pc, videoTransceiver, video) {
|
|
7037
|
+
value: function bindEvents(pc, videoTransceiver, audioTransceiver, video) {
|
|
6969
7038
|
var _this3 = this;
|
|
6970
7039
|
this._pc = pc;
|
|
6971
7040
|
this._video = video;
|
|
6972
7041
|
this._videoTransceiver = videoTransceiver;
|
|
7042
|
+
this._audioTransceiver = audioTransceiver;
|
|
6973
7043
|
pc.addEventListener("connectionstatechange", this._handleConnectionStateChange);
|
|
6974
7044
|
pc.addEventListener("iceconnectionstatechange", this._handleICEConnectionStateChange);
|
|
6975
7045
|
var _ref2 = (videoTransceiver === null || videoTransceiver === void 0 ? void 0 : videoTransceiver.receiver) || {}, transport = _ref2.transport;
|
|
@@ -7043,7 +7113,9 @@ var FirstFrameObserver = /* @__PURE__ */ function() {
|
|
|
7043
7113
|
if (Object.keys(this._state).length > 0) {
|
|
7044
7114
|
var state = _objectSpread2$2({}, this._state);
|
|
7045
7115
|
var extraInfo = _objectSpread2$2({}, this._extraInfo);
|
|
7046
|
-
getTransportInfo(this._videoTransceiver, extraInfo).
|
|
7116
|
+
Promise.all([getTransportInfo(this._videoTransceiver, extraInfo), getAudioCodecInfo(this._audioTransceiver, extraInfo)]).catch(function(e) {
|
|
7117
|
+
extraInfo.failure_reason = e.message;
|
|
7118
|
+
}).finally(function() {
|
|
7047
7119
|
_this5._emitFirstFrameState(state, extraInfo);
|
|
7048
7120
|
});
|
|
7049
7121
|
}
|
|
@@ -7062,6 +7134,7 @@ var FirstFrameObserver = /* @__PURE__ */ function() {
|
|
|
7062
7134
|
this._pc = null;
|
|
7063
7135
|
this._video = null;
|
|
7064
7136
|
this._videoTransceiver = null;
|
|
7137
|
+
this._audioTransceiver = null;
|
|
7065
7138
|
}
|
|
7066
7139
|
}]);
|
|
7067
7140
|
return FirstFrameObserver2;
|
|
@@ -7069,7 +7142,7 @@ var FirstFrameObserver = /* @__PURE__ */ function() {
|
|
|
7069
7142
|
var getTransportInfo = /* @__PURE__ */ function() {
|
|
7070
7143
|
var _ref4 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee2(videoTransceiver, extraInfo) {
|
|
7071
7144
|
var _videoTransceiver$rec;
|
|
7072
|
-
var reports, candidatePairStats, localCandidateStats, remoteCandidateStats;
|
|
7145
|
+
var reports, candidatePairStats, localCandidateStats, remoteCandidateStats, inboundRtpStats, codecStats, _inboundRtpStats4;
|
|
7073
7146
|
return _regeneratorRuntime$1().wrap(function _callee2$(_context2) {
|
|
7074
7147
|
while (1)
|
|
7075
7148
|
switch (_context2.prev = _context2.next) {
|
|
@@ -7084,6 +7157,9 @@ var getTransportInfo = /* @__PURE__ */ function() {
|
|
|
7084
7157
|
candidatePairStats = report;
|
|
7085
7158
|
localCandidateStats = reports.get(report.localCandidateId);
|
|
7086
7159
|
remoteCandidateStats = reports.get(report.remoteCandidateId);
|
|
7160
|
+
} else if (report.type === "inbound-rtp") {
|
|
7161
|
+
inboundRtpStats = report;
|
|
7162
|
+
codecStats = reports.get(report.codecId);
|
|
7087
7163
|
}
|
|
7088
7164
|
});
|
|
7089
7165
|
if (remoteCandidateStats) {
|
|
@@ -7104,7 +7180,20 @@ var getTransportInfo = /* @__PURE__ */ function() {
|
|
|
7104
7180
|
extraInfo.stun_responses_sent = candidatePairStats.responsesSent;
|
|
7105
7181
|
extraInfo.stun_responses_received = candidatePairStats.responsesReceived;
|
|
7106
7182
|
}
|
|
7107
|
-
|
|
7183
|
+
if (codecStats) {
|
|
7184
|
+
extraInfo.video_codec = codecStats.mimeType;
|
|
7185
|
+
extraInfo.video_fmtp = codecStats.sdpFmtpLine;
|
|
7186
|
+
extraInfo.video_profile_level_id = extractProfileInfo(codecStats.sdpFmtpLine);
|
|
7187
|
+
}
|
|
7188
|
+
if (inboundRtpStats) {
|
|
7189
|
+
extraInfo.video_width = inboundRtpStats.frameWidth;
|
|
7190
|
+
extraInfo.video_height = inboundRtpStats.frameHeight;
|
|
7191
|
+
extraInfo.video_framerate = inboundRtpStats.framesPerSecond;
|
|
7192
|
+
extraInfo.video_decoder_name = inboundRtpStats.decoderImplementation;
|
|
7193
|
+
extraInfo.video_result = ((_inboundRtpStats4 = inboundRtpStats) === null || _inboundRtpStats4 === void 0 ? void 0 : _inboundRtpStats4.framesDecoded) > 0 ? true : false;
|
|
7194
|
+
}
|
|
7195
|
+
extraInfo.gpu_info = getGpuInfo().renderer;
|
|
7196
|
+
case 10:
|
|
7108
7197
|
case "end":
|
|
7109
7198
|
return _context2.stop();
|
|
7110
7199
|
}
|
|
@@ -7114,6 +7203,43 @@ var getTransportInfo = /* @__PURE__ */ function() {
|
|
|
7114
7203
|
return _ref4.apply(this, arguments);
|
|
7115
7204
|
};
|
|
7116
7205
|
}();
|
|
7206
|
+
var getAudioCodecInfo = /* @__PURE__ */ function() {
|
|
7207
|
+
var _ref5 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee3(audioTransceiver, extraInfo) {
|
|
7208
|
+
var _audioTransceiver$rec;
|
|
7209
|
+
var reports, inboundRtpStats, codecStats, _inboundRtpStats5, _inboundRtpStats6, _inboundRtpStats7, _inboundRtpStats8, _inboundRtpStats9, _inboundRtpStats10;
|
|
7210
|
+
return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
|
|
7211
|
+
while (1)
|
|
7212
|
+
switch (_context3.prev = _context3.next) {
|
|
7213
|
+
case 0:
|
|
7214
|
+
_context3.next = 2;
|
|
7215
|
+
return audioTransceiver === null || audioTransceiver === void 0 ? void 0 : (_audioTransceiver$rec = audioTransceiver.receiver) === null || _audioTransceiver$rec === void 0 ? void 0 : _audioTransceiver$rec.getStats().catch(function() {
|
|
7216
|
+
});
|
|
7217
|
+
case 2:
|
|
7218
|
+
reports = _context3.sent;
|
|
7219
|
+
reports === null || reports === void 0 ? void 0 : reports.forEach(function(report) {
|
|
7220
|
+
if (report.type === "inbound-rtp") {
|
|
7221
|
+
inboundRtpStats = report;
|
|
7222
|
+
codecStats = reports.get(report.codecId);
|
|
7223
|
+
}
|
|
7224
|
+
});
|
|
7225
|
+
if (codecStats) {
|
|
7226
|
+
extraInfo.audio_codec = codecStats.mimeType;
|
|
7227
|
+
extraInfo.audio_fmtp = codecStats.sdpFmtpLine;
|
|
7228
|
+
}
|
|
7229
|
+
if (inboundRtpStats) {
|
|
7230
|
+
extraInfo.audio_packet_received = ((_inboundRtpStats5 = inboundRtpStats) === null || _inboundRtpStats5 === void 0 ? void 0 : _inboundRtpStats5.packetsReceived) > 0;
|
|
7231
|
+
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;
|
|
7232
|
+
}
|
|
7233
|
+
case 6:
|
|
7234
|
+
case "end":
|
|
7235
|
+
return _context3.stop();
|
|
7236
|
+
}
|
|
7237
|
+
}, _callee3);
|
|
7238
|
+
}));
|
|
7239
|
+
return function getAudioCodecInfo2(_x3, _x4) {
|
|
7240
|
+
return _ref5.apply(this, arguments);
|
|
7241
|
+
};
|
|
7242
|
+
}();
|
|
7117
7243
|
function changeNumberInRange(source, min, max, delta) {
|
|
7118
7244
|
var target = source + delta;
|
|
7119
7245
|
if (target > max) {
|
|
@@ -7394,13 +7520,13 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7394
7520
|
_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;
|
|
7395
7521
|
avDiffTooMuchCount = 0;
|
|
7396
7522
|
_this._setDelayTimer = setInterval(/* @__PURE__ */ _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee3() {
|
|
7397
|
-
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;
|
|
7523
|
+
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;
|
|
7398
7524
|
return _regeneratorRuntime$1().wrap(function _callee3$(_context3) {
|
|
7399
7525
|
while (1)
|
|
7400
7526
|
switch (_context3.prev = _context3.next) {
|
|
7401
7527
|
case 0:
|
|
7402
7528
|
_context3.prev = 0;
|
|
7403
|
-
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))) {
|
|
7529
|
+
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))) {
|
|
7404
7530
|
_context3.next = 5;
|
|
7405
7531
|
break;
|
|
7406
7532
|
}
|
|
@@ -7491,20 +7617,19 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7491
7617
|
}();
|
|
7492
7618
|
_this._getDelay = function() {
|
|
7493
7619
|
try {
|
|
7494
|
-
var _this$
|
|
7620
|
+
var _this$_audioTransceic7;
|
|
7495
7621
|
var key = ["playoutDelayHint", "jitterBufferDelayHint", "jitterBufferTarget"].find(function(key2) {
|
|
7496
|
-
var _this$
|
|
7497
|
-
return key2 in (((_this$
|
|
7622
|
+
var _this$_videoTransceic5, _this$_audioTransceic6;
|
|
7623
|
+
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) || {});
|
|
7498
7624
|
});
|
|
7499
7625
|
if (!key)
|
|
7500
7626
|
return;
|
|
7501
|
-
return (_this$
|
|
7627
|
+
return (_this$_audioTransceic7 = _this._audioTransceicer) === null || _this$_audioTransceic7 === void 0 ? void 0 : _this$_audioTransceic7.receiver[key];
|
|
7502
7628
|
} catch (error) {
|
|
7503
7629
|
logger.error("get delay error");
|
|
7504
7630
|
}
|
|
7505
7631
|
};
|
|
7506
7632
|
_this._onLoaderRetry = function(error, retryTime) {
|
|
7507
|
-
console.log(error, "retryTime", retryTime);
|
|
7508
7633
|
_this.emit(EVENT.LOAD_RETRY, {
|
|
7509
7634
|
error: StreamingError.network(error),
|
|
7510
7635
|
retryTime
|
|
@@ -7596,7 +7721,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7596
7721
|
value: function() {
|
|
7597
7722
|
var _load = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee6(url, failureReason) {
|
|
7598
7723
|
var _this2 = this;
|
|
7599
|
-
var lastPc, answerSdp, errorStr, preloadPromise, info, encodedTransformSupported;
|
|
7724
|
+
var lastPc, pc, answerSdp, errorStr, preloadPromise, info, encodedTransformSupported;
|
|
7600
7725
|
return _regeneratorRuntime$1().wrap(function _callee6$(_context6) {
|
|
7601
7726
|
while (1)
|
|
7602
7727
|
switch (_context6.prev = _context6.next) {
|
|
@@ -7604,44 +7729,47 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7604
7729
|
logger.log("load()", 'invoked, url: "'.concat(url, '"'));
|
|
7605
7730
|
this._disconnect(failureReason || "invoke load");
|
|
7606
7731
|
this._url = url;
|
|
7732
|
+
this._retry = this._opts.retryCount || 0;
|
|
7607
7733
|
lastPc = this._pc;
|
|
7734
|
+
pc = null;
|
|
7608
7735
|
if (!this._opts.hackCreateOfferIssue) {
|
|
7609
|
-
_context6.next =
|
|
7736
|
+
_context6.next = 9;
|
|
7610
7737
|
break;
|
|
7611
7738
|
}
|
|
7612
|
-
_context6.next =
|
|
7739
|
+
_context6.next = 9;
|
|
7613
7740
|
return this._createEmptyPeer();
|
|
7614
|
-
case
|
|
7615
|
-
_context6.prev =
|
|
7741
|
+
case 9:
|
|
7742
|
+
_context6.prev = 9;
|
|
7616
7743
|
this._firstFrameObserver.start();
|
|
7617
7744
|
if (!this._preloadPromise) {
|
|
7618
|
-
_context6.next =
|
|
7745
|
+
_context6.next = 41;
|
|
7619
7746
|
break;
|
|
7620
7747
|
}
|
|
7621
7748
|
logger.log("load()", "in preload process...");
|
|
7622
|
-
_context6.prev =
|
|
7749
|
+
_context6.prev = 13;
|
|
7623
7750
|
this._firstFrameObserver.setIsPreload(true);
|
|
7624
7751
|
if (compareURL(this._url, this._preloadPromise.url, ["tabr_start_bitrate"])) {
|
|
7625
|
-
_context6.next =
|
|
7752
|
+
_context6.next = 19;
|
|
7626
7753
|
break;
|
|
7627
7754
|
}
|
|
7628
7755
|
errorStr = "preload url not match, current url: ".concat(this._url, ", preload url: ").concat(this._preloadPromise.url);
|
|
7629
7756
|
delete this._preloadPromise;
|
|
7630
7757
|
throw new Error(errorStr);
|
|
7631
|
-
case
|
|
7758
|
+
case 19:
|
|
7759
|
+
this._loader && (this._loader.finnalUrl = this._preloadPromise.url);
|
|
7632
7760
|
preloadPromise = this._preloadPromise.promise;
|
|
7633
7761
|
delete this._preloadPromise;
|
|
7634
|
-
_context6.next =
|
|
7762
|
+
_context6.next = 24;
|
|
7635
7763
|
return preloadPromise;
|
|
7636
|
-
case
|
|
7764
|
+
case 24:
|
|
7637
7765
|
info = _context6.sent;
|
|
7638
7766
|
if (!(info.pc.signalingState !== "have-local-offer")) {
|
|
7639
|
-
_context6.next =
|
|
7767
|
+
_context6.next = 27;
|
|
7640
7768
|
break;
|
|
7641
7769
|
}
|
|
7642
7770
|
throw new Error('pc.signalingState not equal "have-local-offer", current state is '.concat(info.pc.signalingState));
|
|
7643
|
-
case
|
|
7644
|
-
|
|
7771
|
+
case 27:
|
|
7772
|
+
pc = info.pc;
|
|
7645
7773
|
answerSdp = info.answerSdp;
|
|
7646
7774
|
this._videoTransceicer = info.videoTransceiver;
|
|
7647
7775
|
this._audioTransceicer = info.audioTransceiver;
|
|
@@ -7649,48 +7777,49 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7649
7777
|
this.initVideoEncodedTransform();
|
|
7650
7778
|
this.initAudioEncodedTransform();
|
|
7651
7779
|
}
|
|
7652
|
-
_context6.next =
|
|
7780
|
+
_context6.next = 39;
|
|
7653
7781
|
break;
|
|
7654
|
-
case
|
|
7655
|
-
_context6.prev =
|
|
7656
|
-
_context6.t0 = _context6["catch"](
|
|
7782
|
+
case 34:
|
|
7783
|
+
_context6.prev = 34;
|
|
7784
|
+
_context6.t0 = _context6["catch"](13);
|
|
7657
7785
|
logger.warn("load()", "preload failed, ".concat(_context6.t0.message || _context6.t0.toString()));
|
|
7658
7786
|
this.load(url, _context6.t0.message || _context6.t0.toString());
|
|
7659
7787
|
return _context6.abrupt("return");
|
|
7660
|
-
case
|
|
7661
|
-
_context6.next =
|
|
7788
|
+
case 39:
|
|
7789
|
+
_context6.next = 47;
|
|
7662
7790
|
break;
|
|
7663
|
-
case
|
|
7791
|
+
case 41:
|
|
7664
7792
|
encodedTransformSupported = isLegacyEncodedTransformSupported();
|
|
7665
7793
|
logger.log("load()", "isLegacyEncodedTransformSupported: ".concat(encodedTransformSupported));
|
|
7666
|
-
|
|
7794
|
+
pc = new RTCPeerConnection({
|
|
7667
7795
|
encodedInsertableStreams: encodedTransformSupported && this._opts.enableSei ? true : void 0
|
|
7668
7796
|
});
|
|
7669
|
-
_context6.next =
|
|
7670
|
-
return this._getAnswerSdp(
|
|
7671
|
-
case
|
|
7797
|
+
_context6.next = 46;
|
|
7798
|
+
return this._getAnswerSdp(pc);
|
|
7799
|
+
case 46:
|
|
7672
7800
|
answerSdp = _context6.sent;
|
|
7673
|
-
case 44:
|
|
7674
|
-
this._bindRTCEvents(this._pc);
|
|
7675
|
-
_context6.next = 47;
|
|
7676
|
-
return this._handleAnswerSdp(this._pc, answerSdp);
|
|
7677
7801
|
case 47:
|
|
7802
|
+
this._bindRTCEvents(pc);
|
|
7803
|
+
_context6.next = 50;
|
|
7804
|
+
return this._handleAnswerSdp(pc, answerSdp);
|
|
7805
|
+
case 50:
|
|
7678
7806
|
if (lastPc) {
|
|
7679
7807
|
lastPc.close();
|
|
7680
7808
|
}
|
|
7681
|
-
|
|
7809
|
+
this._pc = pc;
|
|
7810
|
+
_context6.next = 57;
|
|
7682
7811
|
break;
|
|
7683
|
-
case
|
|
7684
|
-
_context6.prev =
|
|
7685
|
-
_context6.t1 = _context6["catch"](
|
|
7812
|
+
case 54:
|
|
7813
|
+
_context6.prev = 54;
|
|
7814
|
+
_context6.t1 = _context6["catch"](9);
|
|
7686
7815
|
setTimeout(function() {
|
|
7687
7816
|
return _this2._emitError(StreamingError.create(ERR.OTHER, null, _context6.t1));
|
|
7688
7817
|
});
|
|
7689
|
-
case
|
|
7818
|
+
case 57:
|
|
7690
7819
|
case "end":
|
|
7691
7820
|
return _context6.stop();
|
|
7692
7821
|
}
|
|
7693
|
-
}, _callee6, this, [[
|
|
7822
|
+
}, _callee6, this, [[9, 54], [13, 34]]);
|
|
7694
7823
|
}));
|
|
7695
7824
|
function load(_x2, _x3) {
|
|
7696
7825
|
return _load.apply(this, arguments);
|
|
@@ -7833,6 +7962,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7833
7962
|
key: "_getAnswerSdp",
|
|
7834
7963
|
value: function() {
|
|
7835
7964
|
var _getAnswerSdp2 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee7(pc) {
|
|
7965
|
+
var _this6 = this, _this$_opts$standardi;
|
|
7836
7966
|
var offer, answerSdp, parsed, finnalUrl, _this$_opts, _this$_loader, _this$_opts2, _parsed$media, parseSession, sessionId, reqStart, res, answer, err;
|
|
7837
7967
|
return _regeneratorRuntime$1().wrap(function _callee7$(_context7) {
|
|
7838
7968
|
while (1)
|
|
@@ -7884,31 +8014,38 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
7884
8014
|
parsed.media.filter(function(x) {
|
|
7885
8015
|
return x.type === "audio";
|
|
7886
8016
|
}).forEach(function(x) {
|
|
7887
|
-
var _x$rtp$filter$,
|
|
8017
|
+
var _x$rtp$filter$, _this6$_opts$standard, _this6$_opts$standard2;
|
|
7888
8018
|
var opusPayload = (_x$rtp$filter$ = x.rtp.filter(function(rtp) {
|
|
7889
8019
|
return rtp.codec === "opus";
|
|
7890
8020
|
})[0]) === null || _x$rtp$filter$ === void 0 ? void 0 : _x$rtp$filter$.payload;
|
|
7891
8021
|
if (!opusPayload)
|
|
7892
8022
|
return;
|
|
7893
|
-
|
|
7894
|
-
|
|
7895
|
-
|
|
7896
|
-
|
|
7897
|
-
|
|
7898
|
-
|
|
7899
|
-
|
|
7900
|
-
|
|
7901
|
-
|
|
8023
|
+
if ((_this6$_opts$standard = _this6._opts.standardizeKillSwitch) !== null && _this6$_opts$standard !== void 0 && _this6$_opts$standard.sld_fmtp_opus) {
|
|
8024
|
+
x.fmtp.forEach(function(fmtp) {
|
|
8025
|
+
if (fmtp.payload !== opusPayload)
|
|
8026
|
+
return;
|
|
8027
|
+
fmtp.config = "minptime=10;stereo=1;useinbandfec=1";
|
|
8028
|
+
});
|
|
8029
|
+
}
|
|
8030
|
+
if ((_this6$_opts$standard2 = _this6._opts.standardizeKillSwitch) !== null && _this6$_opts$standard2 !== void 0 && _this6$_opts$standard2.sld_rtcpfb_opus_nack) {
|
|
8031
|
+
var _x$rtcpFb;
|
|
8032
|
+
(_x$rtcpFb = x.rtcpFb) === null || _x$rtcpFb === void 0 ? void 0 : _x$rtcpFb.push({
|
|
8033
|
+
payload: opusPayload,
|
|
8034
|
+
type: "nack"
|
|
8035
|
+
});
|
|
8036
|
+
}
|
|
7902
8037
|
});
|
|
7903
|
-
|
|
7904
|
-
|
|
7905
|
-
|
|
7906
|
-
|
|
7907
|
-
|
|
7908
|
-
x2.config
|
|
7909
|
-
|
|
8038
|
+
if ((_this$_opts$standardi = this._opts.standardizeKillSwitch) !== null && _this$_opts$standardi !== void 0 && _this$_opts$standardi.sld_fmtp_sps_pps) {
|
|
8039
|
+
parsed.media.filter(function(x) {
|
|
8040
|
+
return x.type === "video";
|
|
8041
|
+
}).forEach(function(x) {
|
|
8042
|
+
x.fmtp.forEach(function(x2) {
|
|
8043
|
+
if (x2.config.indexOf("profile-level-id") !== -1) {
|
|
8044
|
+
x2.config = "".concat(x2.config, ";sps-pps-idr-in-keyframe=1");
|
|
8045
|
+
}
|
|
8046
|
+
});
|
|
7910
8047
|
});
|
|
7911
|
-
}
|
|
8048
|
+
}
|
|
7912
8049
|
offer.sdp = lib.write(parsed);
|
|
7913
8050
|
logger.log("local offer modified:\n", offer);
|
|
7914
8051
|
_context7.next = 25;
|
|
@@ -8043,7 +8180,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
8043
8180
|
this._firstFrameObserver.changeFirstFrameState(RTC_FIRST_FRAME_STATE.ANSWER_SDP_READY);
|
|
8044
8181
|
this._networkEvaluate = new NetworkEvaluate(pc, this._opts.networkEvaluateInterval);
|
|
8045
8182
|
this._listenPeerStateTimeout();
|
|
8046
|
-
this._firstFrameObserver.bindEvents(pc, this._videoTransceicer, this._media);
|
|
8183
|
+
this._firstFrameObserver.bindEvents(pc, this._videoTransceicer, this._audioTransceicer, this._media);
|
|
8047
8184
|
case 17:
|
|
8048
8185
|
case "end":
|
|
8049
8186
|
return _context8.stop();
|
|
@@ -8058,11 +8195,11 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
8058
8195
|
}, {
|
|
8059
8196
|
key: "_listenPeerStateTimeout",
|
|
8060
8197
|
value: function _listenPeerStateTimeout() {
|
|
8061
|
-
var
|
|
8198
|
+
var _this7 = this;
|
|
8062
8199
|
this._clearPeerStateTimeout();
|
|
8063
8200
|
if (this._opts.connectionStateChangeTimeout) {
|
|
8064
8201
|
this._peerStateTimer = setTimeout(function() {
|
|
8065
|
-
|
|
8202
|
+
_this7._emitError(StreamingError.create(ERR.MEDIA, ERR.SUB_TYPES.MEDIA_ERR_SRC_NOT_SUPPORTED, {
|
|
8066
8203
|
message: "listen connectionstatechange timeout"
|
|
8067
8204
|
}));
|
|
8068
8205
|
}, this._opts.connectionStateChangeTimeout);
|
|
@@ -8079,59 +8216,59 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
8079
8216
|
}, {
|
|
8080
8217
|
key: "_startRtcReport",
|
|
8081
8218
|
value: function _startRtcReport() {
|
|
8082
|
-
var
|
|
8219
|
+
var _this8 = this;
|
|
8083
8220
|
this._stopRtcReport();
|
|
8084
8221
|
var report = /* @__PURE__ */ function() {
|
|
8085
8222
|
var _ref5 = _asyncToGenerator$1(/* @__PURE__ */ _regeneratorRuntime$1().mark(function _callee9() {
|
|
8086
|
-
var
|
|
8087
|
-
var
|
|
8223
|
+
var _this8$_audioTranscei, _this8$_audioTranscei2, _this8$_videoTranscei, _this8$_videoTranscei2;
|
|
8224
|
+
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;
|
|
8088
8225
|
return _regeneratorRuntime$1().wrap(function _callee9$(_context9) {
|
|
8089
8226
|
while (1)
|
|
8090
8227
|
switch (_context9.prev = _context9.next) {
|
|
8091
8228
|
case 0:
|
|
8092
|
-
if (!(!((
|
|
8229
|
+
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))) {
|
|
8093
8230
|
_context9.next = 4;
|
|
8094
8231
|
break;
|
|
8095
8232
|
}
|
|
8096
|
-
|
|
8097
|
-
|
|
8233
|
+
_this8._preAudioStats = null;
|
|
8234
|
+
_this8._preVideoStats = null;
|
|
8098
8235
|
return _context9.abrupt("return");
|
|
8099
8236
|
case 4:
|
|
8100
|
-
if (!
|
|
8101
|
-
|
|
8102
|
-
|
|
8237
|
+
if (!_this8._audioStallObserver && _this8._audioTransceicer) {
|
|
8238
|
+
_this8._audioStallObserver = new AudioStallObserver();
|
|
8239
|
+
_this8._audioStallObserver.start(_this8._audioTransceicer);
|
|
8103
8240
|
}
|
|
8104
|
-
if (!
|
|
8105
|
-
|
|
8106
|
-
|
|
8241
|
+
if (!_this8._videoStallObserver && _this8._video && _this8._media) {
|
|
8242
|
+
_this8._videoStallObserver = new VideoStallObserver();
|
|
8243
|
+
_this8._videoStallObserver.start(_this8._media);
|
|
8107
8244
|
}
|
|
8108
|
-
if (!
|
|
8109
|
-
|
|
8110
|
-
(
|
|
8245
|
+
if (!_this8._frameRecvCallback && _this8._media) {
|
|
8246
|
+
_this8._frameRecvCallback = new VideoFrameRecvCallback();
|
|
8247
|
+
(_this8$_frameRecvCall = _this8._frameRecvCallback) === null || _this8$_frameRecvCall === void 0 ? void 0 : _this8$_frameRecvCall.start(_this8._media);
|
|
8111
8248
|
}
|
|
8112
|
-
if (
|
|
8113
|
-
|
|
8249
|
+
if (_this8._pc && !_this8._networkQuality && _this8._opts.enableNetworkQuality && _this8._opts.networkQuality) {
|
|
8250
|
+
_this8._networkQuality = new NetworkQuality(_this8._pc, _this8._opts.networkQuality);
|
|
8114
8251
|
}
|
|
8115
8252
|
_context9.next = 10;
|
|
8116
|
-
return Promise.all([getRecvAudioStats(
|
|
8253
|
+
return Promise.all([getRecvAudioStats(_this8._audioTransceicer.receiver.getStats()), getRecvVideoStats(_this8._videoTransceicer.receiver.getStats())]);
|
|
8117
8254
|
case 10:
|
|
8118
8255
|
_yield$Promise$all3 = _context9.sent;
|
|
8119
8256
|
_yield$Promise$all4 = _slicedToArray(_yield$Promise$all3, 2);
|
|
8120
8257
|
curAudioStats = _yield$Promise$all4[0];
|
|
8121
8258
|
curVideoStats = _yield$Promise$all4[1];
|
|
8122
|
-
if (!(
|
|
8259
|
+
if (!(_this8._preAudioStats && _this8._preVideoStats)) {
|
|
8123
8260
|
_context9.next = 28;
|
|
8124
8261
|
break;
|
|
8125
8262
|
}
|
|
8126
|
-
audioStats = diffRecvAudioStats(
|
|
8127
|
-
videoStats = diffRecvVideoStats(
|
|
8128
|
-
|
|
8263
|
+
audioStats = diffRecvAudioStats(_this8._preAudioStats, curAudioStats);
|
|
8264
|
+
videoStats = diffRecvVideoStats(_this8._preVideoStats, curVideoStats);
|
|
8265
|
+
_this8._videoJitterBufferDelay = videoStats.jitterBufferDelay;
|
|
8129
8266
|
_context9.next = 20;
|
|
8130
|
-
return (
|
|
8267
|
+
return (_this8$_audioStallObs = _this8._audioStallObserver) === null || _this8$_audioStallObs === void 0 ? void 0 : _this8$_audioStallObs.getAudioStallInfo();
|
|
8131
8268
|
case 20:
|
|
8132
8269
|
audioStallInfo = _context9.sent;
|
|
8133
8270
|
_context9.next = 23;
|
|
8134
|
-
return (
|
|
8271
|
+
return (_this8$_videoStallObs = _this8._videoStallObserver) === null || _this8$_videoStallObs === void 0 ? void 0 : _this8$_videoStallObs.getStallInfo({
|
|
8135
8272
|
interval: videoStats.statsInterval,
|
|
8136
8273
|
frameRateReceived: videoStats.receivedFrameRate,
|
|
8137
8274
|
frameRateDecoded: videoStats.decoderOutputFrameRate,
|
|
@@ -8139,18 +8276,18 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
8139
8276
|
});
|
|
8140
8277
|
case 23:
|
|
8141
8278
|
videoStallInfo = _context9.sent;
|
|
8142
|
-
_ref6 = (
|
|
8279
|
+
_ref6 = (_this8$_networkQualit = (_this8$_networkQualit2 = _this8._networkQuality) === null || _this8$_networkQualit2 === void 0 ? void 0 : _this8$_networkQualit2.getDownlinkQuality(_objectSpread2$2(_objectSpread2$2({}, audioStats), {}, {
|
|
8143
8280
|
stallDuration: (audioStallInfo === null || audioStallInfo === void 0 ? void 0 : audioStallInfo.stallDuration) || 0
|
|
8144
8281
|
}), _objectSpread2$2(_objectSpread2$2({}, videoStats), {}, {
|
|
8145
8282
|
stallDuration: (videoStallInfo === null || videoStallInfo === void 0 ? void 0 : videoStallInfo.stall.stallDuration100ms) || (videoStallInfo === null || videoStallInfo === void 0 ? void 0 : videoStallInfo.stall.stallDuration500ms) || 0
|
|
8146
|
-
}))) !== null &&
|
|
8147
|
-
if (
|
|
8148
|
-
|
|
8283
|
+
}))) !== null && _this8$_networkQualit !== void 0 ? _this8$_networkQualit : [], _ref7 = _slicedToArray(_ref6, 2), quality = _ref7[0], qualityInfo = _ref7[1];
|
|
8284
|
+
if (_this8._opts.enableAdaptiveJitterBuffer) {
|
|
8285
|
+
_this8._handleJitterBuffer(qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos, _this8._opts.adaptiveJitterBuffer, _this8._opts.networkStrategy);
|
|
8149
8286
|
}
|
|
8150
8287
|
if (videoStats.estimatedPlayoutTimestamp && audioStats.estimatedPlayoutTimestamp) {
|
|
8151
8288
|
av_sync_diff = videoStats.estimatedPlayoutTimestamp - audioStats.estimatedPlayoutTimestamp;
|
|
8152
8289
|
}
|
|
8153
|
-
|
|
8290
|
+
_this8.emit(EXTEND_EVENTS.RTC_NETWORK, _objectSpread2$2({
|
|
8154
8291
|
interval: videoStats.statsInterval,
|
|
8155
8292
|
network_quality: quality,
|
|
8156
8293
|
audio_stall_duration: audioStallInfo === null || audioStallInfo === void 0 ? void 0 : audioStallInfo.stallDuration,
|
|
@@ -8176,13 +8313,13 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
8176
8313
|
quality_qos: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.qualityQos,
|
|
8177
8314
|
quality_audio_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.audioQoe,
|
|
8178
8315
|
quality_video_qoe: qualityInfo === null || qualityInfo === void 0 ? void 0 : qualityInfo.videoQoe,
|
|
8179
|
-
current_delay:
|
|
8316
|
+
current_delay: _this8._getDelay(),
|
|
8180
8317
|
visibility_state: document.visibilityState,
|
|
8181
|
-
target_delay:
|
|
8318
|
+
target_delay: _this8._targetDelayHint,
|
|
8182
8319
|
av_sync_diff,
|
|
8183
|
-
set_delay_error:
|
|
8184
|
-
video_width: ((
|
|
8185
|
-
video_height: ((
|
|
8320
|
+
set_delay_error: _this8._setDelayError || null,
|
|
8321
|
+
video_width: ((_this8$_media = _this8._media) === null || _this8$_media === void 0 ? void 0 : _this8$_media.videoWidth) || 0,
|
|
8322
|
+
video_height: ((_this8$_media2 = _this8._media) === null || _this8$_media2 === void 0 ? void 0 : _this8$_media2.videoHeight) || 0,
|
|
8186
8323
|
abr_state: videoStats.abrState || "none",
|
|
8187
8324
|
recv_frame_rate: videoStats.receivedFrameRate,
|
|
8188
8325
|
decode_frame_rate: videoStats.decoderOutputFrameRate,
|
|
@@ -8190,15 +8327,19 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
8190
8327
|
drop_frame_rate: videoStats.framesDropped,
|
|
8191
8328
|
audio_packets_received: audioStats.packetsReceived,
|
|
8192
8329
|
video_packets_received: videoStats.packetsReceived,
|
|
8193
|
-
video_muted: (
|
|
8194
|
-
video_paused: (
|
|
8195
|
-
video_volume: (
|
|
8196
|
-
video_current_time: (
|
|
8197
|
-
|
|
8330
|
+
video_muted: (_this8$_media3 = _this8._media) === null || _this8$_media3 === void 0 ? void 0 : _this8$_media3.muted,
|
|
8331
|
+
video_paused: (_this8$_media4 = _this8._media) === null || _this8$_media4 === void 0 ? void 0 : _this8$_media4.paused,
|
|
8332
|
+
video_volume: (_this8$_media5 = _this8._media) === null || _this8$_media5 === void 0 ? void 0 : _this8$_media5.volume,
|
|
8333
|
+
video_current_time: (_this8$_media6 = _this8._media) === null || _this8$_media6 === void 0 ? void 0 : _this8$_media6.currentTime,
|
|
8334
|
+
fec_packets_received: videoStats.fecPacketsReceived,
|
|
8335
|
+
video_kbps: videoStats.receivedKBitrate,
|
|
8336
|
+
audio_kbps: audioStats.receivedKBitrate,
|
|
8337
|
+
fec_ssrc: videoStats.fecSsrc
|
|
8338
|
+
}, ((_this8$_frameRecvCall2 = _this8._frameRecvCallback) === null || _this8$_frameRecvCall2 === void 0 ? void 0 : _this8$_frameRecvCall2.getRecentRenderInfo4Report()) || {}));
|
|
8198
8339
|
case 28:
|
|
8199
|
-
|
|
8200
|
-
|
|
8201
|
-
|
|
8340
|
+
_this8._preAudioStats = curAudioStats;
|
|
8341
|
+
_this8._preVideoStats = curVideoStats;
|
|
8342
|
+
_this8._setDelayError = null;
|
|
8202
8343
|
case 31:
|
|
8203
8344
|
case "end":
|
|
8204
8345
|
return _context9.stop();
|
|
@@ -8353,7 +8494,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
8353
8494
|
}, {
|
|
8354
8495
|
key: "_changeVolumeInHarmonyWorkaround",
|
|
8355
8496
|
value: function _changeVolumeInHarmonyWorkaround() {
|
|
8356
|
-
var
|
|
8497
|
+
var _this9 = this;
|
|
8357
8498
|
if (isHarmonyOS()) {
|
|
8358
8499
|
var originalDescriptor = Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, "muted");
|
|
8359
8500
|
if (this._media && originalDescriptor) {
|
|
@@ -8372,9 +8513,9 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
8372
8513
|
}
|
|
8373
8514
|
});
|
|
8374
8515
|
this._revertVolumeWorkaround = function() {
|
|
8375
|
-
logger.log("revert HarmonyOS muted workaround. video dom:",
|
|
8376
|
-
if (
|
|
8377
|
-
Object.defineProperty(
|
|
8516
|
+
logger.log("revert HarmonyOS muted workaround. video dom:", _this9._media);
|
|
8517
|
+
if (_this9._media) {
|
|
8518
|
+
Object.defineProperty(_this9._media, "muted", originalDescriptor);
|
|
8378
8519
|
}
|
|
8379
8520
|
};
|
|
8380
8521
|
}
|
|
@@ -8383,7 +8524,7 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
8383
8524
|
}, {
|
|
8384
8525
|
key: "_mutedBeforePlayingWorkaround",
|
|
8385
8526
|
value: function _mutedBeforePlayingWorkaround() {
|
|
8386
|
-
var
|
|
8527
|
+
var _this10 = this;
|
|
8387
8528
|
if (isHeyTapBrowser() || isVivoBrowser()) {
|
|
8388
8529
|
var originalDescriptor = Object.getOwnPropertyDescriptor(HTMLMediaElement.prototype, "muted");
|
|
8389
8530
|
if (this._media && originalDescriptor) {
|
|
@@ -8403,12 +8544,13 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
8403
8544
|
});
|
|
8404
8545
|
var revertMutedProxy = function revertMutedProxy2() {
|
|
8405
8546
|
logger.log("revert muted workaround. muted:", originalMuted);
|
|
8406
|
-
if (
|
|
8407
|
-
Object.defineProperty(
|
|
8408
|
-
|
|
8409
|
-
|
|
8547
|
+
if (_this10._media) {
|
|
8548
|
+
Object.defineProperty(_this10._media, "muted", originalDescriptor);
|
|
8549
|
+
_this10._media.muted = originalMuted;
|
|
8550
|
+
_this10._media.removeEventListener("playing", revertMutedProxy2);
|
|
8410
8551
|
}
|
|
8411
8552
|
};
|
|
8553
|
+
this._revertMutedWorkaround = revertMutedProxy;
|
|
8412
8554
|
this._media.addEventListener("playing", revertMutedProxy);
|
|
8413
8555
|
}
|
|
8414
8556
|
}
|
|
@@ -8416,8 +8558,10 @@ var Rts = /* @__PURE__ */ function(_EventEmitter) {
|
|
|
8416
8558
|
}, {
|
|
8417
8559
|
key: "destroy",
|
|
8418
8560
|
value: function destroy(keepClearMediaStream) {
|
|
8419
|
-
var _this$_revertVolumeWo, _this$_media3;
|
|
8561
|
+
var _this$_revertMutedWor, _this$_revertVolumeWo, _this$_media3;
|
|
8420
8562
|
this._disconnect("invoke destroy");
|
|
8563
|
+
(_this$_revertMutedWor = this._revertMutedWorkaround) === null || _this$_revertMutedWor === void 0 ? void 0 : _this$_revertMutedWor.call(this);
|
|
8564
|
+
delete this._revertMutedWorkaround;
|
|
8421
8565
|
(_this$_revertVolumeWo = this._revertVolumeWorkaround) === null || _this$_revertVolumeWo === void 0 ? void 0 : _this$_revertVolumeWo.call(this);
|
|
8422
8566
|
delete this._revertVolumeWorkaround;
|
|
8423
8567
|
(_this$_media3 = this._media) === null || _this$_media3 === void 0 ? void 0 : _this$_media3.removeEventListener("timeupdate", this._mockWaitingByTimeupdate);
|
|
@@ -8516,15 +8660,19 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8516
8660
|
_this.__retry = function() {
|
|
8517
8661
|
_this.player.removeClass(STATE_CLASS.ERROR);
|
|
8518
8662
|
_this.player.addClass(STATE_CLASS.LOADING);
|
|
8519
|
-
runHooks(_assertThisInitialized$1(_this), "retry", function() {
|
|
8663
|
+
_this.player.runHooks(_assertThisInitialized$1(_this), "retry", function() {
|
|
8520
8664
|
_this.player.src = "";
|
|
8521
8665
|
_this.player.once(CANPLAY, function() {
|
|
8522
|
-
|
|
8666
|
+
var _assertThisInitialize, _assertThisInitialize2;
|
|
8667
|
+
(_assertThisInitialize = _assertThisInitialized$1(_this)) === null || _assertThisInitialize === void 0 ? void 0 : (_assertThisInitialize2 = _assertThisInitialize.player) === null || _assertThisInitialize2 === void 0 ? void 0 : _assertThisInitialize2.mediaPlay();
|
|
8523
8668
|
});
|
|
8524
8669
|
});
|
|
8525
8670
|
};
|
|
8526
8671
|
_this.destroy = function() {
|
|
8527
8672
|
var _this$_rts3;
|
|
8673
|
+
if (typeof _this._originHandleSource === "boolean") {
|
|
8674
|
+
_this.player.handleSource = _this._originHandleSource;
|
|
8675
|
+
}
|
|
8528
8676
|
_this.player.switchURL = _this._originSwitchFn;
|
|
8529
8677
|
_this.player.retry = _this._originRetry;
|
|
8530
8678
|
_this._clearDisconnectTimer();
|
|
@@ -8571,12 +8719,16 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8571
8719
|
}, {
|
|
8572
8720
|
key: "version",
|
|
8573
8721
|
get: function get() {
|
|
8574
|
-
return "0.2.1-alpha.
|
|
8722
|
+
return "0.2.1-alpha.64";
|
|
8575
8723
|
}
|
|
8576
8724
|
}, {
|
|
8577
8725
|
key: "beforePlayerInit",
|
|
8578
8726
|
value: function beforePlayerInit() {
|
|
8579
|
-
var _this$player2, _this$player$config, _this$player$config$r, _this2 = this;
|
|
8727
|
+
var _this$player$video, _this$player2, _this$player$config, _this$player$config$r, _this2 = this;
|
|
8728
|
+
var pl = this.player;
|
|
8729
|
+
this._originHandleSource = pl.handleSource;
|
|
8730
|
+
pl.handleSource = false;
|
|
8731
|
+
(_this$player$video = this.player.video) === null || _this$player$video === void 0 ? void 0 : _this$player$video.removeAttribute("src");
|
|
8580
8732
|
this._init();
|
|
8581
8733
|
if (!this._originSwitchFn) {
|
|
8582
8734
|
var _this$player$switchUR;
|
|
@@ -8606,24 +8758,6 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8606
8758
|
});
|
|
8607
8759
|
}
|
|
8608
8760
|
this._bindRtsEvents();
|
|
8609
|
-
try {
|
|
8610
|
-
BasePlugin.defineGetterOrSetter(this.player, {
|
|
8611
|
-
__url: {
|
|
8612
|
-
get: function get() {
|
|
8613
|
-
try {
|
|
8614
|
-
return URL.createObjectURL(new MediaSource());
|
|
8615
|
-
} catch (e) {
|
|
8616
|
-
var _this2$player, _this2$player$video;
|
|
8617
|
-
if (!((_this2$player = _this2.player) !== null && _this2$player !== void 0 && (_this2$player$video = _this2$player.video) !== null && _this2$player$video !== void 0 && _this2$player$video.srcObject)) {
|
|
8618
|
-
_this2.player.video.srcObject = new MediaStream();
|
|
8619
|
-
}
|
|
8620
|
-
return "";
|
|
8621
|
-
}
|
|
8622
|
-
}
|
|
8623
|
-
}
|
|
8624
|
-
});
|
|
8625
|
-
} catch (e) {
|
|
8626
|
-
}
|
|
8627
8761
|
}
|
|
8628
8762
|
}, {
|
|
8629
8763
|
key: "getStats",
|
|
@@ -8713,6 +8847,9 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8713
8847
|
player.unRegisterPlugin("rts");
|
|
8714
8848
|
player.switchURL = _this3._originSwitchFn;
|
|
8715
8849
|
player.retry = _this3._originRetry;
|
|
8850
|
+
if (typeof _this3._originHandleSource === "boolean") {
|
|
8851
|
+
player.handleSource = _this3._originHandleSource;
|
|
8852
|
+
}
|
|
8716
8853
|
_this3._rts = null;
|
|
8717
8854
|
player.rts = null;
|
|
8718
8855
|
if ((_player$video = player.video) !== null && _player$video !== void 0 && _player$video.srcObject) {
|
|
@@ -8808,6 +8945,11 @@ var RtsPlugin = /* @__PURE__ */ function(_BasePlugin) {
|
|
|
8808
8945
|
}
|
|
8809
8946
|
return isSupportedH264;
|
|
8810
8947
|
}()
|
|
8948
|
+
}, {
|
|
8949
|
+
key: "isEncodedTransformSupported",
|
|
8950
|
+
value: function isEncodedTransformSupported$1() {
|
|
8951
|
+
return isEncodedTransformSupported() || isLegacyEncodedTransformSupported();
|
|
8952
|
+
}
|
|
8811
8953
|
}]);
|
|
8812
8954
|
return RtsPlugin2;
|
|
8813
8955
|
}(BasePlugin);
|