@volcengine/veplayer 2.5.1-rc.2 → 2.5.2-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 +34 -10
- package/esm/veplayer.biz.live.development.js +89 -50
- package/esm/veplayer.biz.live.production.js +1 -1
- package/esm/veplayer.d.ts +156 -56
- package/esm/veplayer.development.js +163 -110
- package/esm/veplayer.live.d.ts +156 -56
- package/esm/veplayer.live.development.js +163 -110
- package/esm/veplayer.live.production.js +3 -5
- package/esm/veplayer.production.js +3 -5
- package/esm/veplayer.vod.d.ts +34 -10
- package/esm/veplayer.vod.development.js +92 -66
- package/esm/veplayer.vod.production.js +3 -5
- package/package.json +1 -1
- package/umd/index.d.ts +34 -10
- package/umd/veplayer.biz.live.development.js +110 -258
- package/umd/veplayer.biz.live.production.js +1 -1
- package/umd/veplayer.d.ts +156 -56
- package/umd/veplayer.development.js +163 -110
- package/umd/veplayer.live.d.ts +156 -56
- package/umd/veplayer.live.development.js +165 -115
- package/umd/veplayer.live.production.js +1 -1
- package/umd/veplayer.production.js +1 -1
- package/umd/veplayer.vod.d.ts +34 -10
- package/umd/veplayer.vod.development.js +92 -66
- package/umd/veplayer.vod.production.js +1 -1
- package/veplayer.d.ts +156 -56
- package/veplayer.live.d.ts +156 -56
- package/veplayer.vod.d.ts +34 -10
|
@@ -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["EMPTY_RTM_FALLBACK_PARAMETER"] = 211] = "EMPTY_RTM_FALLBACK_PARAMETER";
|
|
15
16
|
LiveErrorCode2[LiveErrorCode2["INVALID_LOGGER"] = 220] = "INVALID_LOGGER";
|
|
16
17
|
return LiveErrorCode2;
|
|
17
18
|
})(LiveErrorCode || {});
|
|
@@ -29,12 +30,19 @@ var __publicField = (obj, key, value) => {
|
|
|
29
30
|
messageTextKey: "INVALID_PARAMETER",
|
|
30
31
|
level: error.Level.Fatal
|
|
31
32
|
},
|
|
33
|
+
[
|
|
34
|
+
211
|
|
35
|
+
/* EMPTY_RTM_FALLBACK_PARAMETER */
|
|
36
|
+
]: {
|
|
37
|
+
messageTextKey: "EMPTY_RTM_FALLBACK_PARAMETER",
|
|
38
|
+
level: error.Level.Warn
|
|
39
|
+
},
|
|
32
40
|
[
|
|
33
41
|
220
|
|
34
42
|
/* INVALID_LOGGER */
|
|
35
43
|
]: {
|
|
36
44
|
messageTextKey: "INVALID_LOGGER",
|
|
37
|
-
level: error.Level.
|
|
45
|
+
level: error.Level.Warn
|
|
38
46
|
}
|
|
39
47
|
};
|
|
40
48
|
function create(errorCode, i18n) {
|
|
@@ -58,38 +66,63 @@ var __publicField = (obj, key, value) => {
|
|
|
58
66
|
return RtmPlugin.isSupportedH264();
|
|
59
67
|
return false;
|
|
60
68
|
}
|
|
69
|
+
const getUrlObject = (url) => {
|
|
70
|
+
if (!url) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const withoutProtocol = url.startsWith("//");
|
|
74
|
+
if (withoutProtocol) {
|
|
75
|
+
url = location.protocol + url;
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
return new URL(url);
|
|
79
|
+
} catch (error2) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
};
|
|
61
83
|
const strategy$2 = window["VePlayer"].strategy;
|
|
62
84
|
const util$6 = window["VePlayer"].util;
|
|
63
85
|
const DynamicModule$3 = window["VePlayer"].DynamicModule;
|
|
64
86
|
const load$4 = window["VePlayer"].load;
|
|
65
|
-
const Codec$
|
|
66
|
-
const Sniffer$
|
|
87
|
+
const Codec$3 = window["VePlayer"].Codec;
|
|
88
|
+
const Sniffer$4 = window["VePlayer"].Sniffer;
|
|
67
89
|
const rtmStrategy = {
|
|
68
90
|
options: {},
|
|
69
91
|
module: DynamicModule$3.PluginRtm
|
|
70
92
|
};
|
|
71
93
|
const generateFallbackUrl = (url) => {
|
|
72
|
-
if (Sniffer$
|
|
94
|
+
if (Sniffer$4.device === "pc") {
|
|
73
95
|
return url.replace(".sdp", ".flv");
|
|
74
96
|
} else {
|
|
75
97
|
return url.replace(".sdp", ".m3u8");
|
|
76
98
|
}
|
|
77
99
|
};
|
|
78
|
-
const getRtmStrategy = async (options, player) => {
|
|
79
|
-
var _a;
|
|
100
|
+
const getRtmStrategy = async (options, player, i18n) => {
|
|
101
|
+
var _a, _b;
|
|
80
102
|
let backupStrategy;
|
|
81
|
-
|
|
82
|
-
const {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
const
|
|
103
|
+
let actualFallbackUrl = "";
|
|
104
|
+
const { url, playlist } = options;
|
|
105
|
+
const { fallbackUrl, enableRTMAutoTranscode, ...ret } = options.rtm || {};
|
|
106
|
+
let { enableFallback = true } = options.rtm || {};
|
|
107
|
+
if (playlist == null ? void 0 : playlist.length) {
|
|
108
|
+
enableFallback = false;
|
|
109
|
+
}
|
|
110
|
+
const isRTMAutoTranscode = enableRTMAutoTranscode || ((_a = getUrlObject(url)) == null ? void 0 : _a.searchParams.get("enableRTMAutoTranscode")) === "true";
|
|
111
|
+
if (enableFallback) {
|
|
112
|
+
if (fallbackUrl) {
|
|
113
|
+
actualFallbackUrl = fallbackUrl;
|
|
114
|
+
} else if (isRTMAutoTranscode && url) {
|
|
115
|
+
actualFallbackUrl = generateFallbackUrl(url);
|
|
116
|
+
} else {
|
|
117
|
+
console.warn(
|
|
118
|
+
create(ErrorCode.EMPTY_RTM_FALLBACK_PARAMETER, i18n).message
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
89
122
|
const backupType = actualFallbackUrl && util$6.getStreamType(actualFallbackUrl);
|
|
90
|
-
if (backupType === "flv" && util$6.isMseSupported(Codec$
|
|
123
|
+
if (backupType === "flv" && util$6.isMseSupported(Codec$3.H264)) {
|
|
91
124
|
backupStrategy = strategy$2.createFlvMseStrategy(options);
|
|
92
|
-
} else if (backupType === "hls" && (Sniffer$
|
|
125
|
+
} else if (backupType === "hls" && (Sniffer$4.device !== "mobile" || ((_b = options == null ? void 0 : options.hls) == null ? void 0 : _b.enableMSE)) && util$6.isMseSupported(Codec$3.H264)) {
|
|
93
126
|
backupStrategy = strategy$2.createHlsMseStrategy(options);
|
|
94
127
|
}
|
|
95
128
|
const [rtmCdn, backupCdn] = await Promise.all([
|
|
@@ -104,33 +137,35 @@ var __publicField = (obj, key, value) => {
|
|
|
104
137
|
}
|
|
105
138
|
}).catch(() => void 0)
|
|
106
139
|
]);
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (
|
|
113
|
-
player
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
140
|
+
if (actualFallbackUrl) {
|
|
141
|
+
const [RTMSupported, RTMSupportCodec] = await Promise.all([
|
|
142
|
+
isRTMSupported(),
|
|
143
|
+
isRTMSupportCodec()
|
|
144
|
+
]);
|
|
145
|
+
if (!RTMSupported || !RTMSupportCodec) {
|
|
146
|
+
if (player) {
|
|
147
|
+
player.emit("degrade", {
|
|
148
|
+
url: actualFallbackUrl,
|
|
149
|
+
originRtmUrl: url,
|
|
150
|
+
code: "NOT_SUPPORT",
|
|
151
|
+
message: "not support rtm or h264",
|
|
152
|
+
isRTMSupported: RTMSupported,
|
|
153
|
+
isRTMSupportCodec: RTMSupportCodec
|
|
154
|
+
});
|
|
155
|
+
}
|
|
156
|
+
return {
|
|
157
|
+
options: {
|
|
158
|
+
...(backupStrategy == null ? void 0 : backupStrategy.options) || {},
|
|
159
|
+
url: actualFallbackUrl,
|
|
160
|
+
_RTMdegrade: {
|
|
161
|
+
_originRtmUrl: url,
|
|
162
|
+
_isRTMSupported: RTMSupported,
|
|
163
|
+
_isRTMSupportCodec: RTMSupportCodec
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
plugins: backupCdn ? [backupCdn] : []
|
|
167
|
+
};
|
|
121
168
|
}
|
|
122
|
-
return {
|
|
123
|
-
options: {
|
|
124
|
-
...(backupStrategy == null ? void 0 : backupStrategy.options) || {},
|
|
125
|
-
url: actualFallbackUrl,
|
|
126
|
-
_RTMdegrade: {
|
|
127
|
-
_originRtmUrl: url,
|
|
128
|
-
_isRTMSupported: RTMSupported,
|
|
129
|
-
_isRTMSupportCodec: RTMSupportCodec
|
|
130
|
-
}
|
|
131
|
-
},
|
|
132
|
-
plugins: backupCdn ? [backupCdn] : []
|
|
133
|
-
};
|
|
134
169
|
}
|
|
135
170
|
return {
|
|
136
171
|
options: {
|
|
@@ -147,13 +182,13 @@ var __publicField = (obj, key, value) => {
|
|
|
147
182
|
plugins: rtmCdn ? [rtmCdn] : []
|
|
148
183
|
};
|
|
149
184
|
};
|
|
150
|
-
const Sniffer$
|
|
185
|
+
const Sniffer$3 = window["VePlayer"].Sniffer;
|
|
151
186
|
var DrmType = /* @__PURE__ */ ((DrmType2) => {
|
|
152
187
|
DrmType2["Fairplay"] = "fairplay";
|
|
153
188
|
return DrmType2;
|
|
154
189
|
})(DrmType || {});
|
|
155
190
|
function getDrmType(drm) {
|
|
156
|
-
if ((drm == null ? void 0 : drm.fairplay) && (Sniffer$
|
|
191
|
+
if ((drm == null ? void 0 : drm.fairplay) && (Sniffer$3.browser === "safari" || Sniffer$3.os.isIos)) {
|
|
157
192
|
return "fairplay";
|
|
158
193
|
}
|
|
159
194
|
return;
|
|
@@ -171,37 +206,36 @@ var __publicField = (obj, key, value) => {
|
|
|
171
206
|
}
|
|
172
207
|
return true;
|
|
173
208
|
}
|
|
174
|
-
const Sniffer$
|
|
175
|
-
const Codec$
|
|
209
|
+
const Sniffer$2 = window["VePlayer"].Sniffer;
|
|
210
|
+
const Codec$2 = window["VePlayer"].Codec;
|
|
176
211
|
const util$5 = window["VePlayer"].util;
|
|
177
|
-
const { isMMSSupported: isMMSSupported$
|
|
212
|
+
const { isMMSSupported: isMMSSupported$1, isMseSupported: isMseSupported$1 } = util$5;
|
|
178
213
|
function enableMMS() {
|
|
179
|
-
return Sniffer$
|
|
214
|
+
return Sniffer$2.os.isIos;
|
|
180
215
|
}
|
|
181
|
-
function isFLVSupported
|
|
182
|
-
const isMediaSourceSupported = enableMMS() ? isMMSSupported$
|
|
216
|
+
function isFLVSupported(codec = Codec$2.H264) {
|
|
217
|
+
const isMediaSourceSupported = enableMMS() ? isMMSSupported$1 : isMseSupported$1;
|
|
183
218
|
return isMediaSourceSupported(codec);
|
|
184
219
|
}
|
|
185
220
|
const strategy$1 = window["VePlayer"].strategy;
|
|
186
221
|
const load$3 = window["VePlayer"].load;
|
|
187
|
-
const
|
|
188
|
-
const Codec$2 = window["VePlayer"].Codec;
|
|
222
|
+
const Codec$1 = window["VePlayer"].Codec;
|
|
189
223
|
const util$4 = window["VePlayer"].util;
|
|
190
224
|
const { appendSearchParams } = util$4;
|
|
191
225
|
const getFlvStrategy = async (options) => {
|
|
192
226
|
var _a, _b, _c, _d, _e, _f;
|
|
193
227
|
let mseStrategy;
|
|
194
228
|
let softStrategy;
|
|
195
|
-
const enableLowLatency = (
|
|
229
|
+
const enableLowLatency = (_a = options == null ? void 0 : options.flv) == null ? void 0 : _a.enableLowLatency;
|
|
196
230
|
const enableFrameChasing = ((_c = (_b = options == null ? void 0 : options.flv) == null ? void 0 : _b.lowLatency) == null ? void 0 : _c.enableFrameChasing) ?? true;
|
|
197
231
|
const abrPts = ((_e = (_d = options == null ? void 0 : options.flv) == null ? void 0 : _d.lowLatency) == null ? void 0 : _e.abrPts) ?? "-800";
|
|
198
232
|
const codec = await strategy$1.getCodec(options);
|
|
199
233
|
const isSoftDecode = await strategy$1.isSoftDecode(options, codec);
|
|
200
234
|
if (isSoftDecode) {
|
|
201
|
-
softStrategy = codec === Codec$
|
|
235
|
+
softStrategy = codec === Codec$1.H265 ? strategy$1.createSoftDecodeH265Strategy() : strategy$1.createSoftDecodeH264Strategy();
|
|
202
236
|
mseStrategy = strategy$1.createFlvMseStrategy(options);
|
|
203
237
|
}
|
|
204
|
-
if (codec === "unknown" ? isFLVSupported
|
|
238
|
+
if (codec === "unknown" ? isFLVSupported(Codec$1.H264) : isFLVSupported(codec)) {
|
|
205
239
|
mseStrategy = enableMMS() ? strategy$1.createFlvMssStrategy(options) : strategy$1.createFlvMseStrategy(options);
|
|
206
240
|
}
|
|
207
241
|
if (!mseStrategy && !softStrategy) {
|
|
@@ -230,13 +264,13 @@ var __publicField = (obj, key, value) => {
|
|
|
230
264
|
};
|
|
231
265
|
const util$3 = window["VePlayer"].util;
|
|
232
266
|
const strategy = window["VePlayer"].strategy;
|
|
233
|
-
const getTypeStrategy = async (options, player) => {
|
|
267
|
+
const getTypeStrategy = async (options, player, i18n) => {
|
|
234
268
|
const type = options.url ? util$3.getStreamType(options.url) : "";
|
|
235
269
|
if (!type || type === "unknown") {
|
|
236
270
|
return { options: {}, plugins: [] };
|
|
237
271
|
}
|
|
238
272
|
if (type === "rtm") {
|
|
239
|
-
return await getRtmStrategy(options, player);
|
|
273
|
+
return await getRtmStrategy(options, player, i18n);
|
|
240
274
|
}
|
|
241
275
|
if (type === "flv") {
|
|
242
276
|
return await getFlvStrategy(options);
|
|
@@ -617,9 +651,9 @@ var __publicField = (obj, key, value) => {
|
|
|
617
651
|
}
|
|
618
652
|
return browserInfo;
|
|
619
653
|
}
|
|
620
|
-
var sniffer
|
|
654
|
+
var sniffer = {
|
|
621
655
|
get device() {
|
|
622
|
-
var r2 = sniffer
|
|
656
|
+
var r2 = sniffer.os;
|
|
623
657
|
return r2.isPc ? "pc" : "mobile";
|
|
624
658
|
},
|
|
625
659
|
get browser() {
|
|
@@ -975,7 +1009,7 @@ var __publicField = (obj, key, value) => {
|
|
|
975
1009
|
codec_type: options.codec_type || "h264",
|
|
976
1010
|
width: Math.floor(player.config.width),
|
|
977
1011
|
height: Math.floor(player.config.height),
|
|
978
|
-
browser: sniffer
|
|
1012
|
+
browser: sniffer.browser,
|
|
979
1013
|
ua: navigator.userAgent,
|
|
980
1014
|
href: window.location.href,
|
|
981
1015
|
timestamp: 0,
|
|
@@ -1117,7 +1151,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1117
1151
|
var getNetStat = function getNetStat2() {
|
|
1118
1152
|
if (navgatorOnlineSupported()) {
|
|
1119
1153
|
if (navigator.onLine) {
|
|
1120
|
-
return navigatorConnectionType() || sniffer
|
|
1154
|
+
return navigatorConnectionType() || sniffer.device;
|
|
1121
1155
|
} else {
|
|
1122
1156
|
return "none";
|
|
1123
1157
|
}
|
|
@@ -1131,7 +1165,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1131
1165
|
this.logger = new XgLiveLogger(options);
|
|
1132
1166
|
this.restart = this.restart.bind(this);
|
|
1133
1167
|
this.bindUrlChange();
|
|
1134
|
-
sniffer
|
|
1168
|
+
sniffer.browser.includes("Chrome");
|
|
1135
1169
|
}
|
|
1136
1170
|
var _proto = LoggerControl2.prototype;
|
|
1137
1171
|
_proto.restart = function restart(report_stop) {
|
|
@@ -1253,7 +1287,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1253
1287
|
var player = options.player;
|
|
1254
1288
|
var isHLS = player.hlsOps !== void 0;
|
|
1255
1289
|
this.commonParams = _objectSpread2({
|
|
1256
|
-
os: sniffer
|
|
1290
|
+
os: sniffer.operation_os
|
|
1257
1291
|
}, getCommonLog(options));
|
|
1258
1292
|
this.log = Object.assign({}, getDefaultLog());
|
|
1259
1293
|
var self2 = this;
|
|
@@ -1325,17 +1359,17 @@ var __publicField = (obj, key, value) => {
|
|
|
1325
1359
|
}
|
|
1326
1360
|
};
|
|
1327
1361
|
_proto2.initWindowListener = function initWindowListener() {
|
|
1328
|
-
if (sniffer
|
|
1362
|
+
if (sniffer.device === "pc") {
|
|
1329
1363
|
window.addEventListener("beforeunload", this.handleUserLeave);
|
|
1330
|
-
} else if (sniffer
|
|
1364
|
+
} else if (sniffer.device === "mobile") {
|
|
1331
1365
|
window.addEventListener("beforeunload", this.handleUserLeave);
|
|
1332
1366
|
window.addEventListener("pagehide", this.handleUserLeave);
|
|
1333
1367
|
}
|
|
1334
1368
|
};
|
|
1335
1369
|
_proto2.removeWindowListener = function removeWindowListener() {
|
|
1336
|
-
if (sniffer
|
|
1370
|
+
if (sniffer.device === "pc") {
|
|
1337
1371
|
window.removeEventListener("beforeunload", this.handleUserLeave);
|
|
1338
|
-
} else if (sniffer
|
|
1372
|
+
} else if (sniffer.device === "mobile") {
|
|
1339
1373
|
window.removeEventListener("beforeunload", this.handleUserLeave);
|
|
1340
1374
|
window.removeEventListener("pagehide", this.handleUserLeave);
|
|
1341
1375
|
}
|
|
@@ -2019,9 +2053,9 @@ var __publicField = (obj, key, value) => {
|
|
|
2019
2053
|
this.handleUserLeave();
|
|
2020
2054
|
}
|
|
2021
2055
|
this.destroyed = true;
|
|
2022
|
-
if (sniffer
|
|
2056
|
+
if (sniffer.device === "pc") {
|
|
2023
2057
|
window.removeEventListener("beforeunload", this.handleUserLeave);
|
|
2024
|
-
} else if (sniffer
|
|
2058
|
+
} else if (sniffer.device === "mobile") {
|
|
2025
2059
|
window.removeEventListener("pagehide", this.handleUserLeave);
|
|
2026
2060
|
}
|
|
2027
2061
|
videoEvts.forEach(function(name) {
|
|
@@ -3307,6 +3341,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3307
3341
|
...BaseEN,
|
|
3308
3342
|
INVALID_PARAMETER: "The imported parameter is empty, please pass in necessary parameters such as the stream address",
|
|
3309
3343
|
INVALID_LOGGER: `Log options not configured correctly. Please refer to this document ${logDoc} to configure the logs.`,
|
|
3344
|
+
EMPTY_RTM_FALLBACK_PARAMETER: "Fallback URL for RTM is not configured. Please set enableFallback: false to disable fallback, or configure fallbackUrl for FLV and HLS formats based on the browser environment.",
|
|
3310
3345
|
// info-panel
|
|
3311
3346
|
FORMAT: "format",
|
|
3312
3347
|
FPS: "fps",
|
|
@@ -3326,6 +3361,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3326
3361
|
...BaseZH_CN,
|
|
3327
3362
|
INVALID_PARAMETER: "入参为空,请传入流地址等必要参数",
|
|
3328
3363
|
INVALID_LOGGER: `未正确配置质量日志参数, 请参考 ${logDoc} 配置`,
|
|
3364
|
+
EMPTY_RTM_FALLBACK_PARAMETER: "未配置 RTM 降级地址 fallbackUrl,请设置 enableFallback: false 取消降级或根据浏览器环境配置 FLV、HLS 格式降级地址",
|
|
3329
3365
|
// info-panel
|
|
3330
3366
|
FORMAT: "格式",
|
|
3331
3367
|
FPS: "帧率",
|
|
@@ -3373,167 +3409,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3373
3409
|
}
|
|
3374
3410
|
return {};
|
|
3375
3411
|
};
|
|
3376
|
-
var VERSION_REG = {
|
|
3377
|
-
android: /(Android)\s([\d.]+)/,
|
|
3378
|
-
ios: /(Version)\/([\d.]+)/
|
|
3379
|
-
};
|
|
3380
|
-
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"];
|
|
3381
|
-
var sniffer = {
|
|
3382
|
-
get device() {
|
|
3383
|
-
var r2 = sniffer.os;
|
|
3384
|
-
return r2.isPc ? "pc" : "mobile";
|
|
3385
|
-
},
|
|
3386
|
-
get browser() {
|
|
3387
|
-
if (typeof navigator === "undefined") {
|
|
3388
|
-
return "";
|
|
3389
|
-
}
|
|
3390
|
-
var ua = navigator.userAgent.toLowerCase();
|
|
3391
|
-
var reg = {
|
|
3392
|
-
ie: /rv:([\d.]+)\) like gecko/,
|
|
3393
|
-
firefox: /firefox\/([\d.]+)/,
|
|
3394
|
-
chrome: /chrome\/([\d.]+)/,
|
|
3395
|
-
opera: /opera.([\d.]+)/,
|
|
3396
|
-
safari: /version\/([\d.]+).*safari/
|
|
3397
|
-
};
|
|
3398
|
-
return [].concat(Object.keys(reg).filter(function(key) {
|
|
3399
|
-
return reg[key].test(ua);
|
|
3400
|
-
}))[0];
|
|
3401
|
-
},
|
|
3402
|
-
get os() {
|
|
3403
|
-
if (typeof navigator === "undefined") {
|
|
3404
|
-
return {};
|
|
3405
|
-
}
|
|
3406
|
-
var ua = navigator.userAgent;
|
|
3407
|
-
var isWindowsPhone = /(?:Windows Phone)/.test(ua);
|
|
3408
|
-
var isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone;
|
|
3409
|
-
var isAndroid = /(?:Android)/.test(ua);
|
|
3410
|
-
var isFireFox = /(?:Firefox)/.test(ua);
|
|
3411
|
-
var isIpad = /(?:iPad|PlayBook)/.test(ua) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
3412
|
-
var isTablet = isIpad || isAndroid && !/(?:Mobile)/.test(ua) || isFireFox && /(?:Tablet)/.test(ua);
|
|
3413
|
-
var isPhone = /(?:iPhone)/.test(ua) && !isTablet;
|
|
3414
|
-
var isPc = !isPhone && !isAndroid && !isSymbian && !isTablet;
|
|
3415
|
-
return {
|
|
3416
|
-
isTablet,
|
|
3417
|
-
isPhone,
|
|
3418
|
-
isIpad,
|
|
3419
|
-
isIos: isPhone || isIpad,
|
|
3420
|
-
isAndroid,
|
|
3421
|
-
isPc,
|
|
3422
|
-
isSymbian,
|
|
3423
|
-
isWindowsPhone,
|
|
3424
|
-
isFireFox
|
|
3425
|
-
};
|
|
3426
|
-
},
|
|
3427
|
-
get osVersion() {
|
|
3428
|
-
if (typeof navigator === "undefined") {
|
|
3429
|
-
return 0;
|
|
3430
|
-
}
|
|
3431
|
-
var ua = navigator.userAgent;
|
|
3432
|
-
var reg = "";
|
|
3433
|
-
if (/(?:iPhone)|(?:iPad|PlayBook)/.test(ua)) {
|
|
3434
|
-
reg = VERSION_REG.ios;
|
|
3435
|
-
} else {
|
|
3436
|
-
reg = VERSION_REG.android;
|
|
3437
|
-
}
|
|
3438
|
-
var _match = reg ? reg.exec(ua) : [];
|
|
3439
|
-
if (_match && _match.length >= 3) {
|
|
3440
|
-
var version = _match[2].split(".");
|
|
3441
|
-
return version.length > 0 ? parseInt(version[0]) : 0;
|
|
3442
|
-
}
|
|
3443
|
-
return 0;
|
|
3444
|
-
},
|
|
3445
|
-
get isWeixin() {
|
|
3446
|
-
if (typeof navigator === "undefined") {
|
|
3447
|
-
return false;
|
|
3448
|
-
}
|
|
3449
|
-
var reg = /(micromessenger)\/([\d.]+)/;
|
|
3450
|
-
var match = reg.exec(navigator.userAgent.toLocaleLowerCase());
|
|
3451
|
-
if (match) {
|
|
3452
|
-
return true;
|
|
3453
|
-
}
|
|
3454
|
-
return false;
|
|
3455
|
-
},
|
|
3456
|
-
isSupportMP4: function isSupportMP4() {
|
|
3457
|
-
var result = {
|
|
3458
|
-
isSupport: false,
|
|
3459
|
-
mime: ""
|
|
3460
|
-
};
|
|
3461
|
-
if (typeof document === "undefined") {
|
|
3462
|
-
return result;
|
|
3463
|
-
}
|
|
3464
|
-
if (this.supportResult) {
|
|
3465
|
-
return this.supportResult;
|
|
3466
|
-
}
|
|
3467
|
-
var a2 = document.createElement("video");
|
|
3468
|
-
if (typeof a2.canPlayType === "function") {
|
|
3469
|
-
H264_MIMETYPES.map(function(key) {
|
|
3470
|
-
if (a2.canPlayType('video/mp4; codecs="'.concat(key, '"')) === "probably") {
|
|
3471
|
-
result.isSupport = true;
|
|
3472
|
-
result.mime += "||".concat(key);
|
|
3473
|
-
}
|
|
3474
|
-
});
|
|
3475
|
-
}
|
|
3476
|
-
this.supportResult = result;
|
|
3477
|
-
a2 = null;
|
|
3478
|
-
return result;
|
|
3479
|
-
},
|
|
3480
|
-
isMSESupport: function isMSESupport() {
|
|
3481
|
-
var mime = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';
|
|
3482
|
-
if (typeof MediaSource === "undefined" || !MediaSource)
|
|
3483
|
-
return false;
|
|
3484
|
-
try {
|
|
3485
|
-
return MediaSource.isTypeSupported(mime);
|
|
3486
|
-
} catch (error2) {
|
|
3487
|
-
this._logger.error(mime, error2);
|
|
3488
|
-
return false;
|
|
3489
|
-
}
|
|
3490
|
-
},
|
|
3491
|
-
isHevcSupported: function isHevcSupported() {
|
|
3492
|
-
if (typeof MediaSource === "undefined" || !MediaSource.isTypeSupported) {
|
|
3493
|
-
return false;
|
|
3494
|
-
}
|
|
3495
|
-
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"');
|
|
3496
|
-
},
|
|
3497
|
-
probeConfigSupported: function probeConfigSupported(info) {
|
|
3498
|
-
var defaults = {
|
|
3499
|
-
supported: false,
|
|
3500
|
-
smooth: false,
|
|
3501
|
-
powerEfficient: false
|
|
3502
|
-
};
|
|
3503
|
-
if (!info || typeof navigator === "undefined") {
|
|
3504
|
-
return Promise.resolve(defaults);
|
|
3505
|
-
}
|
|
3506
|
-
if (navigator.mediaCapabilities && navigator.mediaCapabilities.decodingInfo) {
|
|
3507
|
-
return navigator.mediaCapabilities.decodingInfo(info);
|
|
3508
|
-
} else {
|
|
3509
|
-
var videoConfig = info.video || {};
|
|
3510
|
-
var audioConfig = info.audio || {};
|
|
3511
|
-
try {
|
|
3512
|
-
var videoSupported = MediaSource.isTypeSupported(videoConfig.contentType);
|
|
3513
|
-
var audioSupported = MediaSource.isTypeSupported(audioConfig.contentType);
|
|
3514
|
-
return Promise.resolve({
|
|
3515
|
-
supported: videoSupported && audioSupported,
|
|
3516
|
-
smooth: false,
|
|
3517
|
-
powerEfficient: false
|
|
3518
|
-
});
|
|
3519
|
-
} catch (e2) {
|
|
3520
|
-
return Promise.resolve(defaults);
|
|
3521
|
-
}
|
|
3522
|
-
}
|
|
3523
|
-
}
|
|
3524
|
-
};
|
|
3525
|
-
var Codec$1 = /* @__PURE__ */ ((Codec2) => {
|
|
3526
|
-
Codec2["H265"] = "h265";
|
|
3527
|
-
Codec2["H264"] = "h264";
|
|
3528
|
-
return Codec2;
|
|
3529
|
-
})(Codec$1 || {});
|
|
3530
|
-
const H264_MIME = 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';
|
|
3531
|
-
const H265_MIME = [
|
|
3532
|
-
'video/mp4;codecs="hev1.1.6.L120.90"',
|
|
3533
|
-
'video/mp4;codecs="hev1.2.4.L120.90"',
|
|
3534
|
-
'video/mp4;codecs="hev1.3.E.L120.90"',
|
|
3535
|
-
'video/mp4;codecs="hev1.4.10.L120.90"'
|
|
3536
|
-
];
|
|
3537
3412
|
function isType(suffix) {
|
|
3538
3413
|
return function(url) {
|
|
3539
3414
|
return url == null ? void 0 : url.split("?")[0].toLowerCase().includes(suffix);
|
|
@@ -3562,29 +3437,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3562
3437
|
}
|
|
3563
3438
|
return "unknown";
|
|
3564
3439
|
}
|
|
3565
|
-
function isMseSupported$1(codec = Codec$1.H264) {
|
|
3566
|
-
if (codec === Codec$1.H265) {
|
|
3567
|
-
return sniffer.isHevcSupported();
|
|
3568
|
-
}
|
|
3569
|
-
if (codec === Codec$1.H264) {
|
|
3570
|
-
return sniffer.isMSESupport();
|
|
3571
|
-
}
|
|
3572
|
-
return sniffer.isMSESupport(codec);
|
|
3573
|
-
}
|
|
3574
|
-
function isMMSSupported$1(codec = Codec$1.H264) {
|
|
3575
|
-
if (typeof window.ManagedMediaSource === "undefined") {
|
|
3576
|
-
return false;
|
|
3577
|
-
}
|
|
3578
|
-
if (codec === Codec$1.H264) {
|
|
3579
|
-
return window.ManagedMediaSource.isTypeSupported(H264_MIME);
|
|
3580
|
-
}
|
|
3581
|
-
if (codec === Codec$1.H265) {
|
|
3582
|
-
return H265_MIME.some((mine) => {
|
|
3583
|
-
return window.ManagedMediaSource.isTypeSupported(mine);
|
|
3584
|
-
});
|
|
3585
|
-
}
|
|
3586
|
-
return window.ManagedMediaSource.isTypeSupported(codec);
|
|
3587
|
-
}
|
|
3588
3440
|
const DynamicModule$1 = window["VePlayer"].DynamicModule;
|
|
3589
3441
|
const load$1 = window["VePlayer"].load;
|
|
3590
3442
|
const getAbrStrategy = async (options) => {
|
|
@@ -3843,13 +3695,15 @@ var __publicField = (obj, key, value) => {
|
|
|
3843
3695
|
};
|
|
3844
3696
|
},
|
|
3845
3697
|
async preparePlugins(url) {
|
|
3698
|
+
var _a2;
|
|
3846
3699
|
const [typeStrategy, drmStrategy, abrStrategy] = await Promise.all([
|
|
3847
3700
|
getTypeStrategy(
|
|
3848
3701
|
{
|
|
3849
3702
|
...finalOptions,
|
|
3850
3703
|
url
|
|
3851
3704
|
},
|
|
3852
|
-
player
|
|
3705
|
+
player,
|
|
3706
|
+
i18n
|
|
3853
3707
|
),
|
|
3854
3708
|
getDrmStrategy(
|
|
3855
3709
|
{
|
|
@@ -3872,7 +3726,8 @@ var __publicField = (obj, key, value) => {
|
|
|
3872
3726
|
...plugins ?? [],
|
|
3873
3727
|
...drmPlugins ?? [],
|
|
3874
3728
|
...abrPlugins ?? []
|
|
3875
|
-
]
|
|
3729
|
+
],
|
|
3730
|
+
useSrc: !((_a2 = typeStrategy.plugins) == null ? void 0 : _a2.length)
|
|
3876
3731
|
};
|
|
3877
3732
|
}
|
|
3878
3733
|
},
|
|
@@ -3892,9 +3747,6 @@ var __publicField = (obj, key, value) => {
|
|
|
3892
3747
|
}
|
|
3893
3748
|
return player;
|
|
3894
3749
|
}
|
|
3895
|
-
function isFLVSupported() {
|
|
3896
|
-
return isMseSupported$1() || isMMSSupported$1();
|
|
3897
|
-
}
|
|
3898
3750
|
var live = /* @__PURE__ */ Object.freeze({
|
|
3899
3751
|
__proto__: null,
|
|
3900
3752
|
ErrorCode,
|