@volcengine/veplayer 2.5.0 → 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 CHANGED
@@ -1399,13 +1399,13 @@ interface VePlayerBaseOptions extends Omit<PlayerOptions, "autoplay" | "i18n"> {
1399
1399
  */
1400
1400
  interface Fullscreen {
1401
1401
  /** {zh}
1402
- * @brief 切换全屏时,是否旋转为横屏播放,通常在移动端使用。如果开启横屏播放,切换全屏时,将在竖屏状态下把播放器旋转 90 度,实现横屏效果。该配置优先级高于 useCssFullscreen。
1403
- * - `true`:使用旋转横屏;
1404
- * - `false`:不使用旋转横屏。
1402
+ * @brief 切换全屏时,是否旋转为横屏播放,通常在移动端使用。如果开启横屏播放,切换全屏时,将在竖屏状态下把播放器旋转 90 度,实现横屏效果。该配置优先级低于 useCssFullscreen。
1403
+ * - `true`:使用旋转横屏;
1404
+ * - `false`:不使用旋转横屏。
1405
1405
  * @default false
1406
1406
  */
1407
1407
  /** {en}
1408
- * @brief Whether to play the video in landscape mode when the video enters full-screen mode. This feature is usually used on mobile devices. Once enabled, when the video enters fullscreen mode, the player will be rotated from portrait mode by 90 degrees to landscape mode. This property has a higher priority over `useCssFullscreen`.
1408
+ * @brief Whether to play the video in landscape mode when the video enters full-screen mode. This feature is usually used on mobile devices. Once enabled, when the video enters fullscreen mode, the player will be rotated from portrait mode by 90 degrees to landscape mode. This property has a lower priority than `useCssFullscreen`.
1409
1409
  * - `true`: Enable.
1410
1410
  * - `false`: Disable.
1411
1411
  * @default false
@@ -3722,13 +3722,13 @@ declare namespace strategy {
3722
3722
  */
3723
3723
  interface Fullscreen {
3724
3724
  /** {zh}
3725
- * @brief 切换全屏时,是否旋转为横屏播放,通常在移动端使用。如果开启横屏播放,切换全屏时,将在竖屏状态下把播放器旋转 90 度,实现横屏效果。该配置优先级高于 useCssFullscreen。
3726
- * - `true`:使用旋转横屏;
3727
- * - `false`:不使用旋转横屏。
3725
+ * @brief 切换全屏时,是否旋转为横屏播放,通常在移动端使用。如果开启横屏播放,切换全屏时,将在竖屏状态下把播放器旋转 90 度,实现横屏效果。该配置优先级低于 useCssFullscreen。
3726
+ * - `true`:使用旋转横屏;
3727
+ * - `false`:不使用旋转横屏。
3728
3728
  * @default false
3729
3729
  */
3730
3730
  /** {en}
3731
- * @brief Whether to play the video in landscape mode when the video enters full-screen mode. This feature is usually used on mobile devices. Once enabled, when the video enters fullscreen mode, the player will be rotated from portrait mode by 90 degrees to landscape mode. This property has a higher priority over `useCssFullscreen`.
3731
+ * @brief Whether to play the video in landscape mode when the video enters full-screen mode. This feature is usually used on mobile devices. Once enabled, when the video enters fullscreen mode, the player will be rotated from portrait mode by 90 degrees to landscape mode. This property has a lower priority than `useCssFullscreen`.
3732
3732
  * - `true`: Enable.
3733
3733
  * - `false`: Disable.
3734
3734
  * @default false
@@ -4002,13 +4002,6 @@ declare namespace strategy {
4002
4002
  function detectCodec(url: string): Promise<"unknown" | Codec>;
4003
4003
  function isSoftDecode(options: VePlayerBaseOptions, currentCodec?: Codec | "unknown"): Promise<boolean>;
4004
4004
  function combineOptions<T = VePlayerBaseOptions>(strategyList: (Strategy<T> | undefined)[]): Partial<T>;
4005
- const getFlvStrategy: (options: VePlayerBaseOptions) => Promise<{
4006
- options?: undefined;
4007
- plugins?: undefined;
4008
- } | {
4009
- options: Partial<VePlayerBaseOptions>;
4010
- plugins: any[];
4011
- }>;
4012
4005
  const getHlsStrategy: (options: VePlayerBaseOptions) => Promise<{
4013
4006
  options?: undefined;
4014
4007
  plugins?: undefined;
@@ -8,6 +8,7 @@ const error = window["VePlayer"].error;
8
8
  const { VeError } = error;
9
9
  var LiveErrorCode = /* @__PURE__ */ ((LiveErrorCode2) => {
10
10
  LiveErrorCode2[LiveErrorCode2["INVALID_PARAMETER"] = 210] = "INVALID_PARAMETER";
11
+ LiveErrorCode2[LiveErrorCode2["INVALID_LOGGER"] = 220] = "INVALID_LOGGER";
11
12
  return LiveErrorCode2;
12
13
  })(LiveErrorCode || {});
13
14
  error.Level;
@@ -23,35 +24,48 @@ const ERRORS = {
23
24
  ]: {
24
25
  messageTextKey: "INVALID_PARAMETER",
25
26
  level: error.Level.Fatal
27
+ },
28
+ [
29
+ 220
30
+ /* INVALID_LOGGER */
31
+ ]: {
32
+ messageTextKey: "INVALID_LOGGER",
33
+ level: error.Level.Error
26
34
  }
27
35
  };
28
36
  function create(errorCode, i18n) {
29
- return new VeError(ERRORS[errorCode], i18n);
37
+ return new VeError(
38
+ {
39
+ errorCode,
40
+ ...ERRORS[errorCode]
41
+ },
42
+ i18n
43
+ );
30
44
  }
31
45
  const DynamicModule$4 = window["VePlayer"].DynamicModule;
32
- const load$4 = window["VePlayer"].load;
46
+ const load$5 = window["VePlayer"].load;
33
47
  async function isRTMSupported() {
34
- const { RtmPlugin } = await load$4(DynamicModule$4.PluginRtm);
48
+ const { RtmPlugin } = await load$5(DynamicModule$4.PluginRtm);
35
49
  return RtmPlugin.isSupported();
36
50
  }
37
51
  async function isRTMSupportCodec(codec = RTMCodec.H264) {
38
- const { RtmPlugin } = await load$4(DynamicModule$4.PluginRtm);
52
+ const { RtmPlugin } = await load$5(DynamicModule$4.PluginRtm);
39
53
  if (codec === RTMCodec.H264)
40
54
  return RtmPlugin.isSupportedH264();
41
55
  return false;
42
56
  }
43
- const strategy$1 = window["VePlayer"].strategy;
44
- const util$4 = window["VePlayer"].util;
57
+ const strategy$2 = window["VePlayer"].strategy;
58
+ const util$6 = window["VePlayer"].util;
45
59
  const DynamicModule$3 = window["VePlayer"].DynamicModule;
46
- const load$3 = window["VePlayer"].load;
47
- const Codec$2 = window["VePlayer"].Codec;
48
- const Sniffer$3 = window["VePlayer"].Sniffer;
60
+ const load$4 = window["VePlayer"].load;
61
+ const Codec$3 = window["VePlayer"].Codec;
62
+ const Sniffer$5 = window["VePlayer"].Sniffer;
49
63
  const rtmStrategy = {
50
64
  options: {},
51
65
  module: DynamicModule$3.PluginRtm
52
66
  };
53
67
  const generateFallbackUrl = (url) => {
54
- if (Sniffer$3.device === "pc") {
68
+ if (Sniffer$5.device === "pc") {
55
69
  return url.replace(".sdp", ".flv");
56
70
  } else {
57
71
  return url.replace(".sdp", ".m3u8");
@@ -68,17 +82,17 @@ const getRtmStrategy = async (options, player) => {
68
82
  ...ret
69
83
  } = options.rtm || {};
70
84
  const actualFallbackUrl = !enableFallback ? "" : !fallbackUrl && url ? generateFallbackUrl(url) : fallbackUrl;
71
- const backupType = actualFallbackUrl && util$4.getStreamType(actualFallbackUrl);
72
- if (backupType === "flv" && util$4.isMseSupported(Codec$2.H264)) {
73
- backupStrategy = strategy$1.createFlvMseStrategy(options);
74
- } else if (backupType === "hls" && (Sniffer$3.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE)) && util$4.isMseSupported(Codec$2.H264)) {
75
- backupStrategy = strategy$1.createHlsMseStrategy(options);
85
+ const backupType = actualFallbackUrl && util$6.getStreamType(actualFallbackUrl);
86
+ if (backupType === "flv" && util$6.isMseSupported(Codec$3.H264)) {
87
+ backupStrategy = strategy$2.createFlvMseStrategy(options);
88
+ } else if (backupType === "hls" && (Sniffer$5.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE)) && util$6.isMseSupported(Codec$3.H264)) {
89
+ backupStrategy = strategy$2.createHlsMseStrategy(options);
76
90
  }
77
91
  const [rtmCdn, backupCdn] = await Promise.all([
78
- load$3(rtmStrategy.module).then((module) => {
92
+ load$4(rtmStrategy.module).then((module) => {
79
93
  return module.RtmPlugin;
80
94
  }).catch(() => void 0),
81
- backupStrategy && load$3(backupStrategy.module).then((module) => {
95
+ backupStrategy && load$4(backupStrategy.module).then((module) => {
82
96
  if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$3.PluginFlv) {
83
97
  return module.FlvPlugin;
84
98
  } else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$3.PluginHls) {
@@ -117,7 +131,7 @@ const getRtmStrategy = async (options, player) => {
117
131
  return {
118
132
  options: {
119
133
  ...(backupStrategy == null ? void 0 : backupStrategy.options) || {},
120
- url: enableRTMAutoTranscode ? util$4.appendSearchParams(url, { enableRTMAutoTranscode: "true" }) : void 0,
134
+ url: enableRTMAutoTranscode ? util$6.appendSearchParams(url, { enableRTMAutoTranscode: "true" }) : void 0,
121
135
  _RTMdegrade: void 0,
122
136
  rts: {
123
137
  retryCount: 0,
@@ -129,13 +143,13 @@ const getRtmStrategy = async (options, player) => {
129
143
  plugins: rtmCdn ? [rtmCdn] : []
130
144
  };
131
145
  };
132
- const Sniffer$2 = window["VePlayer"].Sniffer;
146
+ const Sniffer$4 = window["VePlayer"].Sniffer;
133
147
  var DrmType = /* @__PURE__ */ ((DrmType2) => {
134
148
  DrmType2["Fairplay"] = "fairplay";
135
149
  return DrmType2;
136
150
  })(DrmType || {});
137
151
  function getDrmType(drm) {
138
- if ((drm == null ? void 0 : drm.fairplay) && (Sniffer$2.browser === "safari" || Sniffer$2.os.isIos)) {
152
+ if ((drm == null ? void 0 : drm.fairplay) && (Sniffer$4.browser === "safari" || Sniffer$4.os.isIos)) {
139
153
  return "fairplay";
140
154
  }
141
155
  return;
@@ -153,6 +167,63 @@ function isMseSupportedWithDrm({
153
167
  }
154
168
  return true;
155
169
  }
170
+ const Sniffer$3 = window["VePlayer"].Sniffer;
171
+ const Codec$2 = window["VePlayer"].Codec;
172
+ const util$5 = window["VePlayer"].util;
173
+ const { isMMSSupported: isMMSSupported$1, isMseSupported: isMseSupported$1 } = util$5;
174
+ function enableMMS() {
175
+ return Sniffer$3.os.isIos;
176
+ }
177
+ function isFLVSupported(codec = Codec$2.H264) {
178
+ const isMediaSourceSupported = enableMMS() ? isMMSSupported$1 : isMseSupported$1;
179
+ return isMediaSourceSupported(codec);
180
+ }
181
+ const strategy$1 = window["VePlayer"].strategy;
182
+ const load$3 = window["VePlayer"].load;
183
+ const Sniffer$2 = window["VePlayer"].Sniffer;
184
+ const Codec$1 = window["VePlayer"].Codec;
185
+ const util$4 = window["VePlayer"].util;
186
+ const { appendSearchParams } = util$4;
187
+ const getFlvStrategy = async (options) => {
188
+ var _a, _b, _c, _d, _e, _f;
189
+ let mseStrategy;
190
+ let softStrategy;
191
+ const enableLowLatency = ((_a = options == null ? void 0 : options.flv) == null ? void 0 : _a.enableLowLatency) && Sniffer$2.device === "pc";
192
+ const enableFrameChasing = ((_c = (_b = options == null ? void 0 : options.flv) == null ? void 0 : _b.lowLatency) == null ? void 0 : _c.enableFrameChasing) ?? true;
193
+ const abrPts = ((_e = (_d = options == null ? void 0 : options.flv) == null ? void 0 : _d.lowLatency) == null ? void 0 : _e.abrPts) ?? "-800";
194
+ const codec = await strategy$1.getCodec(options);
195
+ const isSoftDecode = await strategy$1.isSoftDecode(options, codec);
196
+ if (isSoftDecode) {
197
+ softStrategy = codec === Codec$1.H265 ? strategy$1.createSoftDecodeH265Strategy() : strategy$1.createSoftDecodeH264Strategy();
198
+ mseStrategy = strategy$1.createFlvMseStrategy(options);
199
+ }
200
+ if (codec === "unknown" ? isFLVSupported(Codec$1.H264) : isFLVSupported(codec)) {
201
+ mseStrategy = enableMMS() ? strategy$1.createFlvMssStrategy(options) : strategy$1.createFlvMseStrategy(options);
202
+ }
203
+ if (!mseStrategy && !softStrategy) {
204
+ return {};
205
+ }
206
+ const [mseModule, softModule] = await Promise.all([
207
+ (mseStrategy == null ? void 0 : mseStrategy.module) && load$3(mseStrategy.module).catch(() => void 0),
208
+ (softStrategy == null ? void 0 : softStrategy.module) && load$3(softStrategy.module).catch(() => void 0)
209
+ ]);
210
+ (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));
211
+ const combineOptions = strategy$1.combineOptions([mseStrategy, softStrategy]);
212
+ const plugins = [];
213
+ if (enableLowLatency) {
214
+ combineOptions.url = appendSearchParams(options.url, { abr_pts: abrPts });
215
+ }
216
+ if (mseModule) {
217
+ plugins.push(mseModule.FlvPlugin);
218
+ if (enableLowLatency && enableFrameChasing) {
219
+ plugins.push(mseModule.Adaptive);
220
+ }
221
+ }
222
+ return {
223
+ options: combineOptions,
224
+ plugins
225
+ };
226
+ };
156
227
  const util$3 = window["VePlayer"].util;
157
228
  const strategy = window["VePlayer"].strategy;
158
229
  const getTypeStrategy = async (options, player) => {
@@ -164,7 +235,7 @@ const getTypeStrategy = async (options, player) => {
164
235
  return await getRtmStrategy(options, player);
165
236
  }
166
237
  if (type === "flv") {
167
- return await strategy.getFlvStrategy(options);
238
+ return await getFlvStrategy(options);
168
239
  }
169
240
  if (type === "hls") {
170
241
  if (!isMseSupportedWithDrm({ drm: options.drm, streamType: type })) {
@@ -542,9 +613,9 @@ function getBrowser() {
542
613
  }
543
614
  return browserInfo;
544
615
  }
545
- var sniffer$1 = {
616
+ var sniffer = {
546
617
  get device() {
547
- var r2 = sniffer$1.os;
618
+ var r2 = sniffer.os;
548
619
  return r2.isPc ? "pc" : "mobile";
549
620
  },
550
621
  get browser() {
@@ -900,7 +971,7 @@ function getCommonLog(options) {
900
971
  codec_type: options.codec_type || "h264",
901
972
  width: Math.floor(player.config.width),
902
973
  height: Math.floor(player.config.height),
903
- browser: sniffer$1.browser,
974
+ browser: sniffer.browser,
904
975
  ua: navigator.userAgent,
905
976
  href: window.location.href,
906
977
  timestamp: 0,
@@ -1042,7 +1113,7 @@ var navigatorConnectionType = function navigatorConnectionType2() {
1042
1113
  var getNetStat = function getNetStat2() {
1043
1114
  if (navgatorOnlineSupported()) {
1044
1115
  if (navigator.onLine) {
1045
- return navigatorConnectionType() || sniffer$1.device;
1116
+ return navigatorConnectionType() || sniffer.device;
1046
1117
  } else {
1047
1118
  return "none";
1048
1119
  }
@@ -1056,7 +1127,7 @@ var LoggerControl = /* @__PURE__ */ function() {
1056
1127
  this.logger = new XgLiveLogger(options);
1057
1128
  this.restart = this.restart.bind(this);
1058
1129
  this.bindUrlChange();
1059
- sniffer$1.browser.includes("Chrome");
1130
+ sniffer.browser.includes("Chrome");
1060
1131
  }
1061
1132
  var _proto = LoggerControl2.prototype;
1062
1133
  _proto.restart = function restart(report_stop) {
@@ -1178,7 +1249,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
1178
1249
  var player = options.player;
1179
1250
  var isHLS = player.hlsOps !== void 0;
1180
1251
  this.commonParams = _objectSpread2({
1181
- os: sniffer$1.operation_os
1252
+ os: sniffer.operation_os
1182
1253
  }, getCommonLog(options));
1183
1254
  this.log = Object.assign({}, getDefaultLog());
1184
1255
  var self2 = this;
@@ -1250,17 +1321,17 @@ var XgLiveLogger = /* @__PURE__ */ function() {
1250
1321
  }
1251
1322
  };
1252
1323
  _proto2.initWindowListener = function initWindowListener() {
1253
- if (sniffer$1.device === "pc") {
1324
+ if (sniffer.device === "pc") {
1254
1325
  window.addEventListener("beforeunload", this.handleUserLeave);
1255
- } else if (sniffer$1.device === "mobile") {
1326
+ } else if (sniffer.device === "mobile") {
1256
1327
  window.addEventListener("beforeunload", this.handleUserLeave);
1257
1328
  window.addEventListener("pagehide", this.handleUserLeave);
1258
1329
  }
1259
1330
  };
1260
1331
  _proto2.removeWindowListener = function removeWindowListener() {
1261
- if (sniffer$1.device === "pc") {
1332
+ if (sniffer.device === "pc") {
1262
1333
  window.removeEventListener("beforeunload", this.handleUserLeave);
1263
- } else if (sniffer$1.device === "mobile") {
1334
+ } else if (sniffer.device === "mobile") {
1264
1335
  window.removeEventListener("beforeunload", this.handleUserLeave);
1265
1336
  window.removeEventListener("pagehide", this.handleUserLeave);
1266
1337
  }
@@ -1944,9 +2015,9 @@ var XgLiveLogger = /* @__PURE__ */ function() {
1944
2015
  this.handleUserLeave();
1945
2016
  }
1946
2017
  this.destroyed = true;
1947
- if (sniffer$1.device === "pc") {
2018
+ if (sniffer.device === "pc") {
1948
2019
  window.removeEventListener("beforeunload", this.handleUserLeave);
1949
- } else if (sniffer$1.device === "mobile") {
2020
+ } else if (sniffer.device === "mobile") {
1950
2021
  window.removeEventListener("pagehide", this.handleUserLeave);
1951
2022
  }
1952
2023
  videoEvts.forEach(function(name) {
@@ -2928,7 +2999,7 @@ class Logger extends Plugin$2 {
2928
2999
  }
2929
3000
  static get defaultConfig() {
2930
3001
  return {
2931
- appId: "",
3002
+ appId: 654925,
2932
3003
  enable: true,
2933
3004
  showUserIdInErrorPanel: true
2934
3005
  };
@@ -2938,10 +3009,6 @@ class Logger extends Plugin$2 {
2938
3009
  if (!this.config.enable) {
2939
3010
  return;
2940
3011
  }
2941
- if (!this.config.appId) {
2942
- console.info("not found appId, please generate an appId");
2943
- return;
2944
- }
2945
3012
  this._userId = ((_a = this.config) == null ? void 0 : _a.userId) || getUserId2();
2946
3013
  this._deviceId = ((_b = this.config) == null ? void 0 : _b.deviceId) || getDeviceID2();
2947
3014
  this.open();
@@ -2984,16 +3051,17 @@ class Logger extends Plugin$2 {
2984
3051
  this._liveLogger = new LoggerControl({
2985
3052
  Tea: q,
2986
3053
  player: this.player,
2987
- aid: this.config.appId,
3054
+ aid: this.config.appId || 654925,
2988
3055
  project_key: this.config.appId,
2989
3056
  app_name: this.config.appName || this.config.appId,
2990
3057
  user_id: this._userId,
2991
3058
  device_id: this._deviceId,
3059
+ error_report_stop: true,
2992
3060
  ext: {
2993
- veplayer_version: "2.3.0",
2994
- flv_version: "3.0.21-rc.2",
2995
- hls_version: "3.0.21-rc.2",
2996
- rts_version: "0.2.1-alpha.12"
3061
+ veplayer_version: "2.3.1-rc.1",
3062
+ flv_version: "3.0.21-rc.5",
3063
+ hls_version: "3.0.21-rc.5",
3064
+ rts_version: "0.2.1-alpha.14"
2997
3065
  }
2998
3066
  });
2999
3067
  }
@@ -3229,6 +3297,7 @@ const BaseEN = window["VePlayer"].EN;
3229
3297
  const EN$1 = {
3230
3298
  ...BaseEN,
3231
3299
  INVALID_PARAMETER: "The imported parameter is empty, please pass in necessary parameters such as the stream address",
3300
+ 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.",
3232
3301
  // info-panel
3233
3302
  FORMAT: "format",
3234
3303
  FPS: "fps",
@@ -3247,6 +3316,7 @@ const BaseZH_CN = window["VePlayer"].ZH_CN;
3247
3316
  const ZH_CN$1 = {
3248
3317
  ...BaseZH_CN,
3249
3318
  INVALID_PARAMETER: "入参为空,请传入流地址等必要参数",
3319
+ INVALID_LOGGER: "未正确配置质量日志参数, 请参考 https://www.volcengine.com/docs/6469/138655#日志上报 配置",
3250
3320
  // info-panel
3251
3321
  FORMAT: "格式",
3252
3322
  FPS: "帧率",
@@ -3294,160 +3364,6 @@ const getDrmStrategy = async (options, player) => {
3294
3364
  }
3295
3365
  return {};
3296
3366
  };
3297
- var VERSION_REG = {
3298
- android: /(Android)\s([\d.]+)/,
3299
- ios: /(Version)\/([\d.]+)/
3300
- };
3301
- 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"];
3302
- var sniffer = {
3303
- get device() {
3304
- var r2 = sniffer.os;
3305
- return r2.isPc ? "pc" : "mobile";
3306
- },
3307
- get browser() {
3308
- if (typeof navigator === "undefined") {
3309
- return "";
3310
- }
3311
- var ua = navigator.userAgent.toLowerCase();
3312
- var reg = {
3313
- ie: /rv:([\d.]+)\) like gecko/,
3314
- firefox: /firefox\/([\d.]+)/,
3315
- chrome: /chrome\/([\d.]+)/,
3316
- opera: /opera.([\d.]+)/,
3317
- safari: /version\/([\d.]+).*safari/
3318
- };
3319
- return [].concat(Object.keys(reg).filter(function(key) {
3320
- return reg[key].test(ua);
3321
- }))[0];
3322
- },
3323
- get os() {
3324
- if (typeof navigator === "undefined") {
3325
- return {};
3326
- }
3327
- var ua = navigator.userAgent;
3328
- var isWindowsPhone = /(?:Windows Phone)/.test(ua);
3329
- var isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone;
3330
- var isAndroid = /(?:Android)/.test(ua);
3331
- var isFireFox = /(?:Firefox)/.test(ua);
3332
- var isIpad = /(?:iPad|PlayBook)/.test(ua) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
3333
- var isTablet = isIpad || isAndroid && !/(?:Mobile)/.test(ua) || isFireFox && /(?:Tablet)/.test(ua);
3334
- var isPhone = /(?:iPhone)/.test(ua) && !isTablet;
3335
- var isPc = !isPhone && !isAndroid && !isSymbian && !isTablet;
3336
- return {
3337
- isTablet,
3338
- isPhone,
3339
- isIpad,
3340
- isIos: isPhone || isIpad,
3341
- isAndroid,
3342
- isPc,
3343
- isSymbian,
3344
- isWindowsPhone,
3345
- isFireFox
3346
- };
3347
- },
3348
- get osVersion() {
3349
- if (typeof navigator === "undefined") {
3350
- return 0;
3351
- }
3352
- var ua = navigator.userAgent;
3353
- var reg = "";
3354
- if (/(?:iPhone)|(?:iPad|PlayBook)/.test(ua)) {
3355
- reg = VERSION_REG.ios;
3356
- } else {
3357
- reg = VERSION_REG.android;
3358
- }
3359
- var _match = reg ? reg.exec(ua) : [];
3360
- if (_match && _match.length >= 3) {
3361
- var version = _match[2].split(".");
3362
- return version.length > 0 ? parseInt(version[0]) : 0;
3363
- }
3364
- return 0;
3365
- },
3366
- get isWeixin() {
3367
- if (typeof navigator === "undefined") {
3368
- return false;
3369
- }
3370
- var reg = /(micromessenger)\/([\d.]+)/;
3371
- var match = reg.exec(navigator.userAgent.toLocaleLowerCase());
3372
- if (match) {
3373
- return true;
3374
- }
3375
- return false;
3376
- },
3377
- isSupportMP4: function isSupportMP4() {
3378
- var result = {
3379
- isSupport: false,
3380
- mime: ""
3381
- };
3382
- if (typeof document === "undefined") {
3383
- return result;
3384
- }
3385
- if (this.supportResult) {
3386
- return this.supportResult;
3387
- }
3388
- var a2 = document.createElement("video");
3389
- if (typeof a2.canPlayType === "function") {
3390
- H264_MIMETYPES.map(function(key) {
3391
- if (a2.canPlayType('video/mp4; codecs="'.concat(key, '"')) === "probably") {
3392
- result.isSupport = true;
3393
- result.mime += "||".concat(key);
3394
- }
3395
- });
3396
- }
3397
- this.supportResult = result;
3398
- a2 = null;
3399
- return result;
3400
- },
3401
- isMSESupport: function isMSESupport() {
3402
- var mime = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';
3403
- if (typeof MediaSource === "undefined" || !MediaSource)
3404
- return false;
3405
- try {
3406
- return MediaSource.isTypeSupported(mime);
3407
- } catch (error2) {
3408
- this._logger.error(mime, error2);
3409
- return false;
3410
- }
3411
- },
3412
- isHevcSupported: function isHevcSupported() {
3413
- if (typeof MediaSource === "undefined" || !MediaSource.isTypeSupported) {
3414
- return false;
3415
- }
3416
- 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"');
3417
- },
3418
- probeConfigSupported: function probeConfigSupported(info) {
3419
- var defaults = {
3420
- supported: false,
3421
- smooth: false,
3422
- powerEfficient: false
3423
- };
3424
- if (!info || typeof navigator === "undefined") {
3425
- return Promise.resolve(defaults);
3426
- }
3427
- if (navigator.mediaCapabilities && navigator.mediaCapabilities.decodingInfo) {
3428
- return navigator.mediaCapabilities.decodingInfo(info);
3429
- } else {
3430
- var videoConfig = info.video || {};
3431
- var audioConfig = info.audio || {};
3432
- try {
3433
- var videoSupported = MediaSource.isTypeSupported(videoConfig.contentType);
3434
- var audioSupported = MediaSource.isTypeSupported(audioConfig.contentType);
3435
- return Promise.resolve({
3436
- supported: videoSupported && audioSupported,
3437
- smooth: false,
3438
- powerEfficient: false
3439
- });
3440
- } catch (e3) {
3441
- return Promise.resolve(defaults);
3442
- }
3443
- }
3444
- }
3445
- };
3446
- var Codec$1 = /* @__PURE__ */ ((Codec2) => {
3447
- Codec2["H265"] = "h265";
3448
- Codec2["H264"] = "h264";
3449
- return Codec2;
3450
- })(Codec$1 || {});
3451
3367
  function isType(suffix) {
3452
3368
  return function(url) {
3453
3369
  return url == null ? void 0 : url.split("?")[0].toLowerCase().includes(suffix);
@@ -3476,15 +3392,6 @@ function getStreamType(url) {
3476
3392
  }
3477
3393
  return "unknown";
3478
3394
  }
3479
- function isMseSupported$1(codec = Codec$1.H264) {
3480
- if (codec === Codec$1.H265) {
3481
- return sniffer.isHevcSupported();
3482
- }
3483
- return sniffer.isMSESupport();
3484
- }
3485
- function isMMSSupported$1() {
3486
- return typeof ManagedMediaSource !== "undefined";
3487
- }
3488
3395
  const DynamicModule$1 = window["VePlayer"].DynamicModule;
3489
3396
  const load$1 = window["VePlayer"].load;
3490
3397
  const getAbrStrategy = async (options) => {
@@ -3715,15 +3622,18 @@ class VePlayerLive extends VePlayerBase {
3715
3622
  }
3716
3623
  }
3717
3624
  async function createLivePlayer(options) {
3718
- var _a, _b;
3625
+ var _a, _b, _c, _d;
3719
3626
  let player = void 0;
3720
- if (!options || !options.url && !options.playlist) {
3721
- throw create(ErrorCode.INVALID_PARAMETER, new VeI18n());
3722
- }
3723
3627
  const i18n = new VeI18n({
3724
3628
  lang: options == null ? void 0 : options.lang,
3725
3629
  i18n: options == null ? void 0 : options.i18n
3726
3630
  });
3631
+ if (!options || !options.url && !options.playlist) {
3632
+ throw create(ErrorCode.INVALID_PARAMETER, i18n);
3633
+ }
3634
+ if (!((_a = options.logger) == null ? void 0 : _a.appId) && ((_b = options == null ? void 0 : options.logger) == null ? void 0 : _b.enable) !== false) {
3635
+ console.warn(create(ErrorCode.INVALID_LOGGER, i18n).message);
3636
+ }
3727
3637
  const finalOptions = {
3728
3638
  ...options,
3729
3639
  plugins: [...LIVE_DEFAULT_PLUGINS, ...options.plugins ?? []]
@@ -3776,7 +3686,7 @@ async function createLivePlayer(options) {
3776
3686
  VePlayerLive
3777
3687
  );
3778
3688
  if (player) {
3779
- const RTMDegrade = (_b = (_a = player == null ? void 0 : player._player) == null ? void 0 : _a.config) == null ? void 0 : _b._RTMdegrade;
3689
+ const RTMDegrade = (_d = (_c = player == null ? void 0 : player._player) == null ? void 0 : _c.config) == null ? void 0 : _d._RTMdegrade;
3780
3690
  if (RTMDegrade) {
3781
3691
  player.emit("degrade", {
3782
3692
  originRtmUrl: RTMDegrade._originRtmUrl,
@@ -3789,9 +3699,6 @@ async function createLivePlayer(options) {
3789
3699
  }
3790
3700
  return player;
3791
3701
  }
3792
- function isFLVSupported() {
3793
- return isMseSupported$1() || isMMSSupported$1();
3794
- }
3795
3702
  var live = /* @__PURE__ */ Object.freeze({
3796
3703
  __proto__: null,
3797
3704
  ErrorCode,