@volcengine/veplayer 2.5.0-rc.1 → 2.5.1-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.d.ts +88 -98
- package/esm/veplayer.biz.live.development.js +172 -49
- package/esm/veplayer.biz.live.production.js +1 -1
- package/esm/veplayer.d.ts +1400 -383
- package/esm/veplayer.development.js +301 -143
- package/esm/veplayer.live.d.ts +1401 -383
- package/esm/veplayer.live.development.js +300 -142
- package/esm/veplayer.live.production.js +3 -3
- package/esm/veplayer.production.js +3 -3
- package/esm/veplayer.vod.d.ts +88 -98
- package/esm/veplayer.vod.development.js +127 -58
- package/esm/veplayer.vod.production.js +2 -2
- package/package.json +1 -1
- package/umd/index.d.ts +88 -98
- package/umd/veplayer.biz.live.development.js +371 -61
- package/umd/veplayer.biz.live.production.js +1 -1
- package/umd/veplayer.d.ts +1400 -383
- package/umd/veplayer.development.js +301 -143
- package/umd/veplayer.live.d.ts +1401 -383
- package/umd/veplayer.live.development.js +303 -142
- package/umd/veplayer.live.production.js +1 -1
- package/umd/veplayer.production.js +1 -1
- package/umd/veplayer.vod.d.ts +88 -98
- package/umd/veplayer.vod.development.js +127 -58
- package/umd/veplayer.vod.production.js +1 -1
- package/veplayer.d.ts +1400 -383
- package/veplayer.live.d.ts +1401 -383
- package/veplayer.vod.d.ts +88 -98
|
@@ -12,6 +12,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12
12
|
const { VeError } = error;
|
|
13
13
|
var LiveErrorCode = /* @__PURE__ */ ((LiveErrorCode2) => {
|
|
14
14
|
LiveErrorCode2[LiveErrorCode2["INVALID_PARAMETER"] = 210] = "INVALID_PARAMETER";
|
|
15
|
+
LiveErrorCode2[LiveErrorCode2["INVALID_LOGGER"] = 220] = "INVALID_LOGGER";
|
|
15
16
|
return LiveErrorCode2;
|
|
16
17
|
})(LiveErrorCode || {});
|
|
17
18
|
error.Level;
|
|
@@ -27,35 +28,48 @@ var __publicField = (obj, key, value) => {
|
|
|
27
28
|
]: {
|
|
28
29
|
messageTextKey: "INVALID_PARAMETER",
|
|
29
30
|
level: error.Level.Fatal
|
|
31
|
+
},
|
|
32
|
+
[
|
|
33
|
+
220
|
|
34
|
+
/* INVALID_LOGGER */
|
|
35
|
+
]: {
|
|
36
|
+
messageTextKey: "INVALID_LOGGER",
|
|
37
|
+
level: error.Level.Error
|
|
30
38
|
}
|
|
31
39
|
};
|
|
32
40
|
function create(errorCode, i18n) {
|
|
33
|
-
return new VeError(
|
|
41
|
+
return new VeError(
|
|
42
|
+
{
|
|
43
|
+
errorCode,
|
|
44
|
+
...ERRORS[errorCode]
|
|
45
|
+
},
|
|
46
|
+
i18n
|
|
47
|
+
);
|
|
34
48
|
}
|
|
35
49
|
const DynamicModule$4 = window["VePlayer"].DynamicModule;
|
|
36
|
-
const load$
|
|
50
|
+
const load$5 = window["VePlayer"].load;
|
|
37
51
|
async function isRTMSupported() {
|
|
38
|
-
const { RtmPlugin } = await load$
|
|
52
|
+
const { RtmPlugin } = await load$5(DynamicModule$4.PluginRtm);
|
|
39
53
|
return RtmPlugin.isSupported();
|
|
40
54
|
}
|
|
41
55
|
async function isRTMSupportCodec(codec = RTMCodec.H264) {
|
|
42
|
-
const { RtmPlugin } = await load$
|
|
56
|
+
const { RtmPlugin } = await load$5(DynamicModule$4.PluginRtm);
|
|
43
57
|
if (codec === RTMCodec.H264)
|
|
44
58
|
return RtmPlugin.isSupportedH264();
|
|
45
59
|
return false;
|
|
46
60
|
}
|
|
47
|
-
const strategy$
|
|
48
|
-
const util$
|
|
61
|
+
const strategy$2 = window["VePlayer"].strategy;
|
|
62
|
+
const util$6 = window["VePlayer"].util;
|
|
49
63
|
const DynamicModule$3 = window["VePlayer"].DynamicModule;
|
|
50
|
-
const load$
|
|
51
|
-
const Codec$
|
|
52
|
-
const Sniffer$
|
|
64
|
+
const load$4 = window["VePlayer"].load;
|
|
65
|
+
const Codec$4 = window["VePlayer"].Codec;
|
|
66
|
+
const Sniffer$5 = window["VePlayer"].Sniffer;
|
|
53
67
|
const rtmStrategy = {
|
|
54
68
|
options: {},
|
|
55
69
|
module: DynamicModule$3.PluginRtm
|
|
56
70
|
};
|
|
57
71
|
const generateFallbackUrl = (url) => {
|
|
58
|
-
if (Sniffer$
|
|
72
|
+
if (Sniffer$5.device === "pc") {
|
|
59
73
|
return url.replace(".sdp", ".flv");
|
|
60
74
|
} else {
|
|
61
75
|
return url.replace(".sdp", ".m3u8");
|
|
@@ -72,17 +86,17 @@ var __publicField = (obj, key, value) => {
|
|
|
72
86
|
...ret
|
|
73
87
|
} = options.rtm || {};
|
|
74
88
|
const actualFallbackUrl = !enableFallback ? "" : !fallbackUrl && url ? generateFallbackUrl(url) : fallbackUrl;
|
|
75
|
-
const backupType = actualFallbackUrl && util$
|
|
76
|
-
if (backupType === "flv" && util$
|
|
77
|
-
backupStrategy = strategy$
|
|
78
|
-
} else if (backupType === "hls" && (Sniffer$
|
|
79
|
-
backupStrategy = strategy$
|
|
89
|
+
const backupType = actualFallbackUrl && util$6.getStreamType(actualFallbackUrl);
|
|
90
|
+
if (backupType === "flv" && util$6.isMseSupported(Codec$4.H264)) {
|
|
91
|
+
backupStrategy = strategy$2.createFlvMseStrategy(options);
|
|
92
|
+
} else if (backupType === "hls" && (Sniffer$5.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE)) && util$6.isMseSupported(Codec$4.H264)) {
|
|
93
|
+
backupStrategy = strategy$2.createHlsMseStrategy(options);
|
|
80
94
|
}
|
|
81
95
|
const [rtmCdn, backupCdn] = await Promise.all([
|
|
82
|
-
load$
|
|
96
|
+
load$4(rtmStrategy.module).then((module2) => {
|
|
83
97
|
return module2.RtmPlugin;
|
|
84
98
|
}).catch(() => void 0),
|
|
85
|
-
backupStrategy && load$
|
|
99
|
+
backupStrategy && load$4(backupStrategy.module).then((module2) => {
|
|
86
100
|
if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$3.PluginFlv) {
|
|
87
101
|
return module2.FlvPlugin;
|
|
88
102
|
} else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$3.PluginHls) {
|
|
@@ -121,7 +135,7 @@ var __publicField = (obj, key, value) => {
|
|
|
121
135
|
return {
|
|
122
136
|
options: {
|
|
123
137
|
...(backupStrategy == null ? void 0 : backupStrategy.options) || {},
|
|
124
|
-
url: enableRTMAutoTranscode ? util$
|
|
138
|
+
url: enableRTMAutoTranscode ? util$6.appendSearchParams(url, { enableRTMAutoTranscode: "true" }) : void 0,
|
|
125
139
|
_RTMdegrade: void 0,
|
|
126
140
|
rts: {
|
|
127
141
|
retryCount: 0,
|
|
@@ -133,13 +147,13 @@ var __publicField = (obj, key, value) => {
|
|
|
133
147
|
plugins: rtmCdn ? [rtmCdn] : []
|
|
134
148
|
};
|
|
135
149
|
};
|
|
136
|
-
const Sniffer$
|
|
150
|
+
const Sniffer$4 = window["VePlayer"].Sniffer;
|
|
137
151
|
var DrmType = /* @__PURE__ */ ((DrmType2) => {
|
|
138
152
|
DrmType2["Fairplay"] = "fairplay";
|
|
139
153
|
return DrmType2;
|
|
140
154
|
})(DrmType || {});
|
|
141
155
|
function getDrmType(drm) {
|
|
142
|
-
if ((drm == null ? void 0 : drm.fairplay) && (Sniffer$
|
|
156
|
+
if ((drm == null ? void 0 : drm.fairplay) && (Sniffer$4.browser === "safari" || Sniffer$4.os.isIos)) {
|
|
143
157
|
return "fairplay";
|
|
144
158
|
}
|
|
145
159
|
return;
|
|
@@ -157,6 +171,63 @@ var __publicField = (obj, key, value) => {
|
|
|
157
171
|
}
|
|
158
172
|
return true;
|
|
159
173
|
}
|
|
174
|
+
const Sniffer$3 = window["VePlayer"].Sniffer;
|
|
175
|
+
const Codec$3 = window["VePlayer"].Codec;
|
|
176
|
+
const util$5 = window["VePlayer"].util;
|
|
177
|
+
const { isMMSSupported: isMMSSupported$2, isMseSupported: isMseSupported$2 } = util$5;
|
|
178
|
+
function enableMMS() {
|
|
179
|
+
return Sniffer$3.os.isIos;
|
|
180
|
+
}
|
|
181
|
+
function isFLVSupported$1(codec = Codec$3.H264) {
|
|
182
|
+
const isMediaSourceSupported = enableMMS() ? isMMSSupported$2 : isMseSupported$2;
|
|
183
|
+
return isMediaSourceSupported(codec);
|
|
184
|
+
}
|
|
185
|
+
const strategy$1 = window["VePlayer"].strategy;
|
|
186
|
+
const load$3 = window["VePlayer"].load;
|
|
187
|
+
const Sniffer$2 = window["VePlayer"].Sniffer;
|
|
188
|
+
const Codec$2 = window["VePlayer"].Codec;
|
|
189
|
+
const util$4 = window["VePlayer"].util;
|
|
190
|
+
const { appendSearchParams } = util$4;
|
|
191
|
+
const getFlvStrategy = async (options) => {
|
|
192
|
+
var _a, _b, _c, _d, _e, _f;
|
|
193
|
+
let mseStrategy;
|
|
194
|
+
let softStrategy;
|
|
195
|
+
const enableLowLatency = ((_a = options == null ? void 0 : options.flv) == null ? void 0 : _a.enableLowLatency) && Sniffer$2.device === "pc";
|
|
196
|
+
const enableFrameChasing = ((_c = (_b = options == null ? void 0 : options.flv) == null ? void 0 : _b.lowLatency) == null ? void 0 : _c.enableFrameChasing) ?? true;
|
|
197
|
+
const abrPts = ((_e = (_d = options == null ? void 0 : options.flv) == null ? void 0 : _d.lowLatency) == null ? void 0 : _e.abrPts) ?? "-800";
|
|
198
|
+
const codec = await strategy$1.getCodec(options);
|
|
199
|
+
const isSoftDecode = await strategy$1.isSoftDecode(options, codec);
|
|
200
|
+
if (isSoftDecode) {
|
|
201
|
+
softStrategy = codec === Codec$2.H265 ? strategy$1.createSoftDecodeH265Strategy() : strategy$1.createSoftDecodeH264Strategy();
|
|
202
|
+
mseStrategy = strategy$1.createFlvMseStrategy(options);
|
|
203
|
+
}
|
|
204
|
+
if (codec === "unknown" ? isFLVSupported$1(Codec$2.H264) : isFLVSupported$1(codec)) {
|
|
205
|
+
mseStrategy = enableMMS() ? strategy$1.createFlvMssStrategy(options) : strategy$1.createFlvMseStrategy(options);
|
|
206
|
+
}
|
|
207
|
+
if (!mseStrategy && !softStrategy) {
|
|
208
|
+
return {};
|
|
209
|
+
}
|
|
210
|
+
const [mseModule, softModule] = await Promise.all([
|
|
211
|
+
(mseStrategy == null ? void 0 : mseStrategy.module) && load$3(mseStrategy.module).catch(() => void 0),
|
|
212
|
+
(softStrategy == null ? void 0 : softStrategy.module) && load$3(softStrategy.module).catch(() => void 0)
|
|
213
|
+
]);
|
|
214
|
+
(softModule == null ? void 0 : softModule.XGVideoPlugin) && ((_f = softStrategy == null ? void 0 : softStrategy.afterLoad) == null ? void 0 : _f.call(softStrategy, softModule == null ? void 0 : softModule.XGVideoPlugin));
|
|
215
|
+
const combineOptions = strategy$1.combineOptions([mseStrategy, softStrategy]);
|
|
216
|
+
const plugins = [];
|
|
217
|
+
if (enableLowLatency) {
|
|
218
|
+
combineOptions.url = appendSearchParams(options.url, { abr_pts: abrPts });
|
|
219
|
+
}
|
|
220
|
+
if (mseModule) {
|
|
221
|
+
plugins.push(mseModule.FlvPlugin);
|
|
222
|
+
if (enableLowLatency && enableFrameChasing) {
|
|
223
|
+
plugins.push(mseModule.Adaptive);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
return {
|
|
227
|
+
options: combineOptions,
|
|
228
|
+
plugins
|
|
229
|
+
};
|
|
230
|
+
};
|
|
160
231
|
const util$3 = window["VePlayer"].util;
|
|
161
232
|
const strategy = window["VePlayer"].strategy;
|
|
162
233
|
const getTypeStrategy = async (options, player) => {
|
|
@@ -168,7 +239,7 @@ var __publicField = (obj, key, value) => {
|
|
|
168
239
|
return await getRtmStrategy(options, player);
|
|
169
240
|
}
|
|
170
241
|
if (type === "flv") {
|
|
171
|
-
return await
|
|
242
|
+
return await getFlvStrategy(options);
|
|
172
243
|
}
|
|
173
244
|
if (type === "hls") {
|
|
174
245
|
if (!isMseSupportedWithDrm({ drm: options.drm, streamType: type })) {
|
|
@@ -546,9 +617,9 @@ var __publicField = (obj, key, value) => {
|
|
|
546
617
|
}
|
|
547
618
|
return browserInfo;
|
|
548
619
|
}
|
|
549
|
-
var sniffer = {
|
|
620
|
+
var sniffer$1 = {
|
|
550
621
|
get device() {
|
|
551
|
-
var r2 = sniffer.os;
|
|
622
|
+
var r2 = sniffer$1.os;
|
|
552
623
|
return r2.isPc ? "pc" : "mobile";
|
|
553
624
|
},
|
|
554
625
|
get browser() {
|
|
@@ -904,7 +975,7 @@ var __publicField = (obj, key, value) => {
|
|
|
904
975
|
codec_type: options.codec_type || "h264",
|
|
905
976
|
width: Math.floor(player.config.width),
|
|
906
977
|
height: Math.floor(player.config.height),
|
|
907
|
-
browser: sniffer.browser,
|
|
978
|
+
browser: sniffer$1.browser,
|
|
908
979
|
ua: navigator.userAgent,
|
|
909
980
|
href: window.location.href,
|
|
910
981
|
timestamp: 0,
|
|
@@ -1046,7 +1117,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1046
1117
|
var getNetStat = function getNetStat2() {
|
|
1047
1118
|
if (navgatorOnlineSupported()) {
|
|
1048
1119
|
if (navigator.onLine) {
|
|
1049
|
-
return navigatorConnectionType() || sniffer.device;
|
|
1120
|
+
return navigatorConnectionType() || sniffer$1.device;
|
|
1050
1121
|
} else {
|
|
1051
1122
|
return "none";
|
|
1052
1123
|
}
|
|
@@ -1060,7 +1131,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1060
1131
|
this.logger = new XgLiveLogger(options);
|
|
1061
1132
|
this.restart = this.restart.bind(this);
|
|
1062
1133
|
this.bindUrlChange();
|
|
1063
|
-
sniffer.browser.includes("Chrome");
|
|
1134
|
+
sniffer$1.browser.includes("Chrome");
|
|
1064
1135
|
}
|
|
1065
1136
|
var _proto = LoggerControl2.prototype;
|
|
1066
1137
|
_proto.restart = function restart(report_stop) {
|
|
@@ -1182,7 +1253,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1182
1253
|
var player = options.player;
|
|
1183
1254
|
var isHLS = player.hlsOps !== void 0;
|
|
1184
1255
|
this.commonParams = _objectSpread2({
|
|
1185
|
-
os: sniffer.operation_os
|
|
1256
|
+
os: sniffer$1.operation_os
|
|
1186
1257
|
}, getCommonLog(options));
|
|
1187
1258
|
this.log = Object.assign({}, getDefaultLog());
|
|
1188
1259
|
var self2 = this;
|
|
@@ -1254,17 +1325,17 @@ var __publicField = (obj, key, value) => {
|
|
|
1254
1325
|
}
|
|
1255
1326
|
};
|
|
1256
1327
|
_proto2.initWindowListener = function initWindowListener() {
|
|
1257
|
-
if (sniffer.device === "pc") {
|
|
1328
|
+
if (sniffer$1.device === "pc") {
|
|
1258
1329
|
window.addEventListener("beforeunload", this.handleUserLeave);
|
|
1259
|
-
} else if (sniffer.device === "mobile") {
|
|
1330
|
+
} else if (sniffer$1.device === "mobile") {
|
|
1260
1331
|
window.addEventListener("beforeunload", this.handleUserLeave);
|
|
1261
1332
|
window.addEventListener("pagehide", this.handleUserLeave);
|
|
1262
1333
|
}
|
|
1263
1334
|
};
|
|
1264
1335
|
_proto2.removeWindowListener = function removeWindowListener() {
|
|
1265
|
-
if (sniffer.device === "pc") {
|
|
1336
|
+
if (sniffer$1.device === "pc") {
|
|
1266
1337
|
window.removeEventListener("beforeunload", this.handleUserLeave);
|
|
1267
|
-
} else if (sniffer.device === "mobile") {
|
|
1338
|
+
} else if (sniffer$1.device === "mobile") {
|
|
1268
1339
|
window.removeEventListener("beforeunload", this.handleUserLeave);
|
|
1269
1340
|
window.removeEventListener("pagehide", this.handleUserLeave);
|
|
1270
1341
|
}
|
|
@@ -1948,9 +2019,9 @@ var __publicField = (obj, key, value) => {
|
|
|
1948
2019
|
this.handleUserLeave();
|
|
1949
2020
|
}
|
|
1950
2021
|
this.destroyed = true;
|
|
1951
|
-
if (sniffer.device === "pc") {
|
|
2022
|
+
if (sniffer$1.device === "pc") {
|
|
1952
2023
|
window.removeEventListener("beforeunload", this.handleUserLeave);
|
|
1953
|
-
} else if (sniffer.device === "mobile") {
|
|
2024
|
+
} else if (sniffer$1.device === "mobile") {
|
|
1954
2025
|
window.removeEventListener("pagehide", this.handleUserLeave);
|
|
1955
2026
|
}
|
|
1956
2027
|
videoEvts.forEach(function(name) {
|
|
@@ -2932,7 +3003,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2932
3003
|
}
|
|
2933
3004
|
static get defaultConfig() {
|
|
2934
3005
|
return {
|
|
2935
|
-
appId:
|
|
3006
|
+
appId: 654925,
|
|
2936
3007
|
enable: true,
|
|
2937
3008
|
showUserIdInErrorPanel: true
|
|
2938
3009
|
};
|
|
@@ -2942,10 +3013,6 @@ var __publicField = (obj, key, value) => {
|
|
|
2942
3013
|
if (!this.config.enable) {
|
|
2943
3014
|
return;
|
|
2944
3015
|
}
|
|
2945
|
-
if (!this.config.appId) {
|
|
2946
|
-
console.info("not found appId, please generate an appId");
|
|
2947
|
-
return;
|
|
2948
|
-
}
|
|
2949
3016
|
this._userId = ((_a = this.config) == null ? void 0 : _a.userId) || getUserId();
|
|
2950
3017
|
this._deviceId = ((_b = this.config) == null ? void 0 : _b.deviceId) || getDeviceID();
|
|
2951
3018
|
this.open();
|
|
@@ -2988,16 +3055,17 @@ var __publicField = (obj, key, value) => {
|
|
|
2988
3055
|
this._liveLogger = new LoggerControl({
|
|
2989
3056
|
Tea: q,
|
|
2990
3057
|
player: this.player,
|
|
2991
|
-
aid: this.config.appId,
|
|
3058
|
+
aid: this.config.appId || 654925,
|
|
2992
3059
|
project_key: this.config.appId,
|
|
2993
3060
|
app_name: this.config.appName || this.config.appId,
|
|
2994
3061
|
user_id: this._userId,
|
|
2995
3062
|
device_id: this._deviceId,
|
|
3063
|
+
error_report_stop: true,
|
|
2996
3064
|
ext: {
|
|
2997
3065
|
veplayer_version: "2.3.1-rc.1",
|
|
2998
|
-
flv_version: "3.0.
|
|
2999
|
-
hls_version: "3.0.
|
|
3000
|
-
rts_version: "0.2.1-alpha.
|
|
3066
|
+
flv_version: "3.0.21-rc.5",
|
|
3067
|
+
hls_version: "3.0.21-rc.5",
|
|
3068
|
+
rts_version: "0.2.1-alpha.14"
|
|
3001
3069
|
}
|
|
3002
3070
|
});
|
|
3003
3071
|
}
|
|
@@ -3233,6 +3301,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3233
3301
|
const EN$1 = {
|
|
3234
3302
|
...BaseEN,
|
|
3235
3303
|
INVALID_PARAMETER: "The imported parameter is empty, please pass in necessary parameters such as the stream address",
|
|
3304
|
+
INVALID_LOGGER: "Log options not configured correctly. Please refer to this document https://docs.byteplus.com/en/docs/byteplus-media-live/docs-feature-implementation#uploading-logs to configure the logs.",
|
|
3236
3305
|
// info-panel
|
|
3237
3306
|
FORMAT: "format",
|
|
3238
3307
|
FPS: "fps",
|
|
@@ -3251,6 +3320,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3251
3320
|
const ZH_CN$1 = {
|
|
3252
3321
|
...BaseZH_CN,
|
|
3253
3322
|
INVALID_PARAMETER: "入参为空,请传入流地址等必要参数",
|
|
3323
|
+
INVALID_LOGGER: "未正确配置质量日志参数, 请参考 https://www.volcengine.com/docs/6469/138655#日志上报 配置",
|
|
3254
3324
|
// info-panel
|
|
3255
3325
|
FORMAT: "格式",
|
|
3256
3326
|
FPS: "帧率",
|
|
@@ -3298,6 +3368,167 @@ var __publicField = (obj, key, value) => {
|
|
|
3298
3368
|
}
|
|
3299
3369
|
return {};
|
|
3300
3370
|
};
|
|
3371
|
+
var VERSION_REG = {
|
|
3372
|
+
android: /(Android)\s([\d.]+)/,
|
|
3373
|
+
ios: /(Version)\/([\d.]+)/
|
|
3374
|
+
};
|
|
3375
|
+
var H264_MIMETYPES = ["avc1.42E01E, mp4a.40.2", "avc1.58A01E, mp4a.40.2", "avc1.4D401E, mp4a.40.2", "avc1.64001E, mp4a.40.2", "avc1.42E01E", "mp4v.20.8", "mp4v.20.8, mp4a.40.2", "mp4v.20.240, mp4a.40.2"];
|
|
3376
|
+
var sniffer = {
|
|
3377
|
+
get device() {
|
|
3378
|
+
var r2 = sniffer.os;
|
|
3379
|
+
return r2.isPc ? "pc" : "mobile";
|
|
3380
|
+
},
|
|
3381
|
+
get browser() {
|
|
3382
|
+
if (typeof navigator === "undefined") {
|
|
3383
|
+
return "";
|
|
3384
|
+
}
|
|
3385
|
+
var ua = navigator.userAgent.toLowerCase();
|
|
3386
|
+
var reg = {
|
|
3387
|
+
ie: /rv:([\d.]+)\) like gecko/,
|
|
3388
|
+
firefox: /firefox\/([\d.]+)/,
|
|
3389
|
+
chrome: /chrome\/([\d.]+)/,
|
|
3390
|
+
opera: /opera.([\d.]+)/,
|
|
3391
|
+
safari: /version\/([\d.]+).*safari/
|
|
3392
|
+
};
|
|
3393
|
+
return [].concat(Object.keys(reg).filter(function(key) {
|
|
3394
|
+
return reg[key].test(ua);
|
|
3395
|
+
}))[0];
|
|
3396
|
+
},
|
|
3397
|
+
get os() {
|
|
3398
|
+
if (typeof navigator === "undefined") {
|
|
3399
|
+
return {};
|
|
3400
|
+
}
|
|
3401
|
+
var ua = navigator.userAgent;
|
|
3402
|
+
var isWindowsPhone = /(?:Windows Phone)/.test(ua);
|
|
3403
|
+
var isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone;
|
|
3404
|
+
var isAndroid = /(?:Android)/.test(ua);
|
|
3405
|
+
var isFireFox = /(?:Firefox)/.test(ua);
|
|
3406
|
+
var isIpad = /(?:iPad|PlayBook)/.test(ua) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
3407
|
+
var isTablet = isIpad || isAndroid && !/(?:Mobile)/.test(ua) || isFireFox && /(?:Tablet)/.test(ua);
|
|
3408
|
+
var isPhone = /(?:iPhone)/.test(ua) && !isTablet;
|
|
3409
|
+
var isPc = !isPhone && !isAndroid && !isSymbian && !isTablet;
|
|
3410
|
+
return {
|
|
3411
|
+
isTablet,
|
|
3412
|
+
isPhone,
|
|
3413
|
+
isIpad,
|
|
3414
|
+
isIos: isPhone || isIpad,
|
|
3415
|
+
isAndroid,
|
|
3416
|
+
isPc,
|
|
3417
|
+
isSymbian,
|
|
3418
|
+
isWindowsPhone,
|
|
3419
|
+
isFireFox
|
|
3420
|
+
};
|
|
3421
|
+
},
|
|
3422
|
+
get osVersion() {
|
|
3423
|
+
if (typeof navigator === "undefined") {
|
|
3424
|
+
return 0;
|
|
3425
|
+
}
|
|
3426
|
+
var ua = navigator.userAgent;
|
|
3427
|
+
var reg = "";
|
|
3428
|
+
if (/(?:iPhone)|(?:iPad|PlayBook)/.test(ua)) {
|
|
3429
|
+
reg = VERSION_REG.ios;
|
|
3430
|
+
} else {
|
|
3431
|
+
reg = VERSION_REG.android;
|
|
3432
|
+
}
|
|
3433
|
+
var _match = reg ? reg.exec(ua) : [];
|
|
3434
|
+
if (_match && _match.length >= 3) {
|
|
3435
|
+
var version = _match[2].split(".");
|
|
3436
|
+
return version.length > 0 ? parseInt(version[0]) : 0;
|
|
3437
|
+
}
|
|
3438
|
+
return 0;
|
|
3439
|
+
},
|
|
3440
|
+
get isWeixin() {
|
|
3441
|
+
if (typeof navigator === "undefined") {
|
|
3442
|
+
return false;
|
|
3443
|
+
}
|
|
3444
|
+
var reg = /(micromessenger)\/([\d.]+)/;
|
|
3445
|
+
var match = reg.exec(navigator.userAgent.toLocaleLowerCase());
|
|
3446
|
+
if (match) {
|
|
3447
|
+
return true;
|
|
3448
|
+
}
|
|
3449
|
+
return false;
|
|
3450
|
+
},
|
|
3451
|
+
isSupportMP4: function isSupportMP4() {
|
|
3452
|
+
var result = {
|
|
3453
|
+
isSupport: false,
|
|
3454
|
+
mime: ""
|
|
3455
|
+
};
|
|
3456
|
+
if (typeof document === "undefined") {
|
|
3457
|
+
return result;
|
|
3458
|
+
}
|
|
3459
|
+
if (this.supportResult) {
|
|
3460
|
+
return this.supportResult;
|
|
3461
|
+
}
|
|
3462
|
+
var a2 = document.createElement("video");
|
|
3463
|
+
if (typeof a2.canPlayType === "function") {
|
|
3464
|
+
H264_MIMETYPES.map(function(key) {
|
|
3465
|
+
if (a2.canPlayType('video/mp4; codecs="'.concat(key, '"')) === "probably") {
|
|
3466
|
+
result.isSupport = true;
|
|
3467
|
+
result.mime += "||".concat(key);
|
|
3468
|
+
}
|
|
3469
|
+
});
|
|
3470
|
+
}
|
|
3471
|
+
this.supportResult = result;
|
|
3472
|
+
a2 = null;
|
|
3473
|
+
return result;
|
|
3474
|
+
},
|
|
3475
|
+
isMSESupport: function isMSESupport() {
|
|
3476
|
+
var mime = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';
|
|
3477
|
+
if (typeof MediaSource === "undefined" || !MediaSource)
|
|
3478
|
+
return false;
|
|
3479
|
+
try {
|
|
3480
|
+
return MediaSource.isTypeSupported(mime);
|
|
3481
|
+
} catch (error2) {
|
|
3482
|
+
this._logger.error(mime, error2);
|
|
3483
|
+
return false;
|
|
3484
|
+
}
|
|
3485
|
+
},
|
|
3486
|
+
isHevcSupported: function isHevcSupported() {
|
|
3487
|
+
if (typeof MediaSource === "undefined" || !MediaSource.isTypeSupported) {
|
|
3488
|
+
return false;
|
|
3489
|
+
}
|
|
3490
|
+
return MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"') || MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"') || MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"') || MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"');
|
|
3491
|
+
},
|
|
3492
|
+
probeConfigSupported: function probeConfigSupported(info) {
|
|
3493
|
+
var defaults = {
|
|
3494
|
+
supported: false,
|
|
3495
|
+
smooth: false,
|
|
3496
|
+
powerEfficient: false
|
|
3497
|
+
};
|
|
3498
|
+
if (!info || typeof navigator === "undefined") {
|
|
3499
|
+
return Promise.resolve(defaults);
|
|
3500
|
+
}
|
|
3501
|
+
if (navigator.mediaCapabilities && navigator.mediaCapabilities.decodingInfo) {
|
|
3502
|
+
return navigator.mediaCapabilities.decodingInfo(info);
|
|
3503
|
+
} else {
|
|
3504
|
+
var videoConfig = info.video || {};
|
|
3505
|
+
var audioConfig = info.audio || {};
|
|
3506
|
+
try {
|
|
3507
|
+
var videoSupported = MediaSource.isTypeSupported(videoConfig.contentType);
|
|
3508
|
+
var audioSupported = MediaSource.isTypeSupported(audioConfig.contentType);
|
|
3509
|
+
return Promise.resolve({
|
|
3510
|
+
supported: videoSupported && audioSupported,
|
|
3511
|
+
smooth: false,
|
|
3512
|
+
powerEfficient: false
|
|
3513
|
+
});
|
|
3514
|
+
} catch (e2) {
|
|
3515
|
+
return Promise.resolve(defaults);
|
|
3516
|
+
}
|
|
3517
|
+
}
|
|
3518
|
+
}
|
|
3519
|
+
};
|
|
3520
|
+
var Codec$1 = /* @__PURE__ */ ((Codec2) => {
|
|
3521
|
+
Codec2["H265"] = "h265";
|
|
3522
|
+
Codec2["H264"] = "h264";
|
|
3523
|
+
return Codec2;
|
|
3524
|
+
})(Codec$1 || {});
|
|
3525
|
+
const H264_MIME = 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';
|
|
3526
|
+
const H265_MIME = [
|
|
3527
|
+
'video/mp4;codecs="hev1.1.6.L120.90"',
|
|
3528
|
+
'video/mp4;codecs="hev1.2.4.L120.90"',
|
|
3529
|
+
'video/mp4;codecs="hev1.3.E.L120.90"',
|
|
3530
|
+
'video/mp4;codecs="hev1.4.10.L120.90"'
|
|
3531
|
+
];
|
|
3301
3532
|
function isType(suffix) {
|
|
3302
3533
|
return function(url) {
|
|
3303
3534
|
return url == null ? void 0 : url.split("?")[0].toLowerCase().includes(suffix);
|
|
@@ -3326,6 +3557,29 @@ var __publicField = (obj, key, value) => {
|
|
|
3326
3557
|
}
|
|
3327
3558
|
return "unknown";
|
|
3328
3559
|
}
|
|
3560
|
+
function isMseSupported$1(codec = Codec$1.H264) {
|
|
3561
|
+
if (codec === Codec$1.H265) {
|
|
3562
|
+
return sniffer.isHevcSupported();
|
|
3563
|
+
}
|
|
3564
|
+
if (codec === Codec$1.H264) {
|
|
3565
|
+
return sniffer.isMSESupport();
|
|
3566
|
+
}
|
|
3567
|
+
return sniffer.isMSESupport(codec);
|
|
3568
|
+
}
|
|
3569
|
+
function isMMSSupported$1(codec = Codec$1.H264) {
|
|
3570
|
+
if (typeof window.ManagedMediaSource === "undefined") {
|
|
3571
|
+
return false;
|
|
3572
|
+
}
|
|
3573
|
+
if (codec === Codec$1.H264) {
|
|
3574
|
+
return window.ManagedMediaSource.isTypeSupported(H264_MIME);
|
|
3575
|
+
}
|
|
3576
|
+
if (codec === Codec$1.H265) {
|
|
3577
|
+
return H265_MIME.some((mine) => {
|
|
3578
|
+
return window.ManagedMediaSource.isTypeSupported(mine);
|
|
3579
|
+
});
|
|
3580
|
+
}
|
|
3581
|
+
return window.ManagedMediaSource.isTypeSupported(codec);
|
|
3582
|
+
}
|
|
3329
3583
|
const DynamicModule$1 = window["VePlayer"].DynamicModule;
|
|
3330
3584
|
const load$1 = window["VePlayer"].load;
|
|
3331
3585
|
const getAbrStrategy = async (options) => {
|
|
@@ -3365,7 +3619,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3365
3619
|
}
|
|
3366
3620
|
]);
|
|
3367
3621
|
const LIVE_DEFAULT_OPTIONS = {
|
|
3368
|
-
autoplay: {
|
|
3622
|
+
autoplay: {
|
|
3623
|
+
muted: true
|
|
3624
|
+
}
|
|
3369
3625
|
};
|
|
3370
3626
|
const LIVE_DEFAULT_PLUGINS = [...DEFAULT_PLUGINS, Refresh, Logger, InfoPanel];
|
|
3371
3627
|
var RTMCodec = /* @__PURE__ */ ((RTMCodec2) => {
|
|
@@ -3385,7 +3641,10 @@ var __publicField = (obj, key, value) => {
|
|
|
3385
3641
|
super(options);
|
|
3386
3642
|
}
|
|
3387
3643
|
/** {zh}
|
|
3388
|
-
* @brief
|
|
3644
|
+
* @brief 获取已经播放的时长,不包含暂停和等待时间,单位为秒。
|
|
3645
|
+
*/
|
|
3646
|
+
/** {en}
|
|
3647
|
+
* @brief Obtain the duration that has been played, excluding pause and waiting time, with the unit of seconds.
|
|
3389
3648
|
*/
|
|
3390
3649
|
get playTime() {
|
|
3391
3650
|
var _a, _b, _c, _d;
|
|
@@ -3444,7 +3703,10 @@ var __publicField = (obj, key, value) => {
|
|
|
3444
3703
|
(_a = this._player.plugins) == null ? void 0 : _a.infopanel.close();
|
|
3445
3704
|
}
|
|
3446
3705
|
/** {zh}
|
|
3447
|
-
* @brief
|
|
3706
|
+
* @brief 打开码率自适应(ABR)切换功能。
|
|
3707
|
+
*/
|
|
3708
|
+
/** {en}
|
|
3709
|
+
* @brief Enable the Adaptive Bitrate Streaming (ABR) switching feature.
|
|
3448
3710
|
*/
|
|
3449
3711
|
openAbr() {
|
|
3450
3712
|
var _a, _b, _c, _d;
|
|
@@ -3458,7 +3720,10 @@ var __publicField = (obj, key, value) => {
|
|
|
3458
3720
|
}
|
|
3459
3721
|
}
|
|
3460
3722
|
/** {zh}
|
|
3461
|
-
* @brief
|
|
3723
|
+
* @brief 关闭码率自适应(ABR)切换功能。
|
|
3724
|
+
*/
|
|
3725
|
+
/** {en}
|
|
3726
|
+
* @brief Disable the Adaptive Bitrate Streaming (ABR) switching feature.
|
|
3462
3727
|
*/
|
|
3463
3728
|
closeAbr() {
|
|
3464
3729
|
var _a, _b, _c, _d;
|
|
@@ -3472,18 +3737,25 @@ var __publicField = (obj, key, value) => {
|
|
|
3472
3737
|
}
|
|
3473
3738
|
}
|
|
3474
3739
|
/** {zh}
|
|
3475
|
-
* @brief 调用此方法更新 DRM
|
|
3476
|
-
|
|
3740
|
+
* @brief 调用此方法更新 DRM 配置。
|
|
3741
|
+
*/
|
|
3742
|
+
/** {en}
|
|
3743
|
+
* @brief Use this method to update DRM configuration.
|
|
3744
|
+
* @param config
|
|
3477
3745
|
*/
|
|
3478
3746
|
updateDrmConfig(config) {
|
|
3479
3747
|
var _a, _b, _c;
|
|
3480
3748
|
(_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config);
|
|
3481
3749
|
}
|
|
3482
3750
|
/** {zh}
|
|
3483
|
-
* @brief
|
|
3484
|
-
* @param options
|
|
3751
|
+
* @brief 修改 ABR 配置,包含修改是否开启 ABR 功能,和修改其他清晰度。
|
|
3752
|
+
* @param options ABR 的配置。
|
|
3485
3753
|
* @returns
|
|
3486
3754
|
*/
|
|
3755
|
+
/** {en}
|
|
3756
|
+
* @brief Modify ABR configuration, including enabling or disabling the ABR feature and adjusting other resolutions.
|
|
3757
|
+
* @param options Configuration of ABR.
|
|
3758
|
+
*/
|
|
3487
3759
|
switchAbr(options) {
|
|
3488
3760
|
var _a, _b;
|
|
3489
3761
|
if (!((_a = this._player.plugins) == null ? void 0 : _a.abr)) {
|
|
@@ -3494,7 +3766,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3494
3766
|
if (!url) {
|
|
3495
3767
|
return;
|
|
3496
3768
|
}
|
|
3497
|
-
this.switch(url, {
|
|
3769
|
+
this.switch(url, {
|
|
3770
|
+
seamless: true
|
|
3771
|
+
});
|
|
3498
3772
|
this._player.plugins.abr.bitrate = options.bitrate;
|
|
3499
3773
|
}
|
|
3500
3774
|
if (typeof (options == null ? void 0 : options.enable) !== "undefined") {
|
|
@@ -3502,37 +3776,52 @@ var __publicField = (obj, key, value) => {
|
|
|
3502
3776
|
}
|
|
3503
3777
|
}
|
|
3504
3778
|
/** {zh}
|
|
3505
|
-
* @brief 获取 RTM
|
|
3779
|
+
* @brief 获取 RTM 拉流的网络评估信息。
|
|
3506
3780
|
* @returns
|
|
3507
3781
|
*/
|
|
3782
|
+
/** {en}
|
|
3783
|
+
* @brief Obtain the network assessment information of RTM pull streaming.
|
|
3784
|
+
*/
|
|
3508
3785
|
getRTMNetWorkInfo() {
|
|
3509
3786
|
var _a, _b, _c;
|
|
3510
3787
|
return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.rts) == null ? void 0 : _c.getNetWorkInfo();
|
|
3511
3788
|
}
|
|
3512
3789
|
/** {zh}
|
|
3513
|
-
* @brief 获取 RTM
|
|
3790
|
+
* @brief 获取 RTM 拉流的播放信息。
|
|
3514
3791
|
* @returns
|
|
3515
3792
|
*/
|
|
3793
|
+
/** {en}
|
|
3794
|
+
* @brief Obtain the playback information of RTM pull stream.
|
|
3795
|
+
*/
|
|
3516
3796
|
async getRTMStats() {
|
|
3517
3797
|
var _a, _b, _c;
|
|
3518
3798
|
return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.rts) == null ? void 0 : _c.getStatsSnapshoot();
|
|
3519
3799
|
}
|
|
3520
3800
|
/** {zh}
|
|
3521
|
-
* @brief 获取 FLV
|
|
3801
|
+
* @brief 获取 FLV 拉流的播放信息。
|
|
3522
3802
|
* @returns
|
|
3523
3803
|
*/
|
|
3804
|
+
/** {en}
|
|
3805
|
+
* @brief Obtain the playback information of FLV pull streaming.
|
|
3806
|
+
*/
|
|
3524
3807
|
getFLVStats() {
|
|
3525
3808
|
var _a, _b, _c;
|
|
3526
3809
|
return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.flv) == null ? void 0 : _c.getStats();
|
|
3527
3810
|
}
|
|
3528
3811
|
}
|
|
3529
3812
|
async function createLivePlayer(options) {
|
|
3530
|
-
var _a, _b;
|
|
3813
|
+
var _a, _b, _c, _d;
|
|
3531
3814
|
let player = void 0;
|
|
3815
|
+
const i18n = new VeI18n({
|
|
3816
|
+
lang: options == null ? void 0 : options.lang,
|
|
3817
|
+
i18n: options == null ? void 0 : options.i18n
|
|
3818
|
+
});
|
|
3532
3819
|
if (!options || !options.url && !options.playlist) {
|
|
3533
|
-
throw create(ErrorCode.INVALID_PARAMETER,
|
|
3820
|
+
throw create(ErrorCode.INVALID_PARAMETER, i18n);
|
|
3821
|
+
}
|
|
3822
|
+
if (!((_a = options.logger) == null ? void 0 : _a.appId) && ((_b = options == null ? void 0 : options.logger) == null ? void 0 : _b.enable) !== false) {
|
|
3823
|
+
console.warn(create(ErrorCode.INVALID_LOGGER, i18n).message);
|
|
3534
3824
|
}
|
|
3535
|
-
const i18n = new VeI18n({ lang: options == null ? void 0 : options.lang, i18n: options == null ? void 0 : options.i18n });
|
|
3536
3825
|
const finalOptions = {
|
|
3537
3826
|
...options,
|
|
3538
3827
|
plugins: [...LIVE_DEFAULT_PLUGINS, ...options.plugins ?? []]
|
|
@@ -3550,9 +3839,24 @@ var __publicField = (obj, key, value) => {
|
|
|
3550
3839
|
},
|
|
3551
3840
|
async preparePlugins(url) {
|
|
3552
3841
|
const [typeStrategy, drmStrategy, abrStrategy] = await Promise.all([
|
|
3553
|
-
getTypeStrategy(
|
|
3554
|
-
|
|
3555
|
-
|
|
3842
|
+
getTypeStrategy(
|
|
3843
|
+
{
|
|
3844
|
+
...finalOptions,
|
|
3845
|
+
url
|
|
3846
|
+
},
|
|
3847
|
+
player
|
|
3848
|
+
),
|
|
3849
|
+
getDrmStrategy(
|
|
3850
|
+
{
|
|
3851
|
+
...finalOptions,
|
|
3852
|
+
url
|
|
3853
|
+
},
|
|
3854
|
+
player
|
|
3855
|
+
),
|
|
3856
|
+
getAbrStrategy({
|
|
3857
|
+
...finalOptions,
|
|
3858
|
+
url
|
|
3859
|
+
})
|
|
3556
3860
|
]);
|
|
3557
3861
|
const { options: options2, plugins } = typeStrategy ?? {};
|
|
3558
3862
|
const { options: drmOptions, plugins: drmPlugins } = drmStrategy ?? {};
|
|
@@ -3570,7 +3874,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3570
3874
|
VePlayerLive
|
|
3571
3875
|
);
|
|
3572
3876
|
if (player) {
|
|
3573
|
-
const RTMDegrade = (
|
|
3877
|
+
const RTMDegrade = (_d = (_c = player == null ? void 0 : player._player) == null ? void 0 : _c.config) == null ? void 0 : _d._RTMdegrade;
|
|
3574
3878
|
if (RTMDegrade) {
|
|
3575
3879
|
player.emit("degrade", {
|
|
3576
3880
|
originRtmUrl: RTMDegrade._originRtmUrl,
|
|
@@ -3583,6 +3887,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3583
3887
|
}
|
|
3584
3888
|
return player;
|
|
3585
3889
|
}
|
|
3890
|
+
function isFLVSupported() {
|
|
3891
|
+
return isMseSupported$1() || isMMSSupported$1();
|
|
3892
|
+
}
|
|
3586
3893
|
var live = /* @__PURE__ */ Object.freeze({
|
|
3587
3894
|
__proto__: null,
|
|
3588
3895
|
ErrorCode,
|
|
@@ -3606,6 +3913,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3606
3913
|
setModuleSystem("umd");
|
|
3607
3914
|
const isMseSupported = util.isMseSupported;
|
|
3608
3915
|
const isSoftDecodeSupported = util.isSoftDecodeSupported;
|
|
3916
|
+
const isMMSSupported = util.isMMSSupported;
|
|
3609
3917
|
if (typeof VePlayer.registerPlugin !== "undefined") {
|
|
3610
3918
|
VePlayer.registerPlugin(DynamicModule.BizLive, {
|
|
3611
3919
|
createLivePlayer
|
|
@@ -3627,6 +3935,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3627
3935
|
exports2.Sniffer = Sniffer;
|
|
3628
3936
|
exports2.ZH_CN = ZH_CN;
|
|
3629
3937
|
exports2.createLivePlayer = createLivePlayer;
|
|
3938
|
+
exports2.isFLVSupported = isFLVSupported;
|
|
3939
|
+
exports2.isMMSSupported = isMMSSupported;
|
|
3630
3940
|
exports2.isMseSupported = isMseSupported;
|
|
3631
3941
|
exports2.isRTMSupportCodec = isRTMSupportCodec;
|
|
3632
3942
|
exports2.isRTMSupported = isRTMSupported;
|