@volcengine/veplayer 2.4.1-rc.0 → 2.5.0-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.
@@ -40,72 +40,15 @@ async function isRTMSupportCodec(codec = RTMCodec.H264) {
40
40
  return RtmPlugin.isSupportedH264();
41
41
  return false;
42
42
  }
43
- var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
44
- function getDefaultExportFromCjs(x2) {
45
- return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
46
- }
47
- function isType(suffix) {
48
- return function(url) {
49
- return url == null ? void 0 : url.split("?")[0].toLowerCase().includes(suffix);
50
- };
51
- }
52
- const isHls = isType(".m3u8");
53
- const isMp4 = isType(".mp4");
54
- const isFlv = isType(".flv");
55
- const isRtm = isType(".sdp");
56
- const isDash = isType(".mpd");
57
- function getStreamType(url) {
58
- if (isHls(url)) {
59
- return "hls";
60
- }
61
- if (isFlv(url)) {
62
- return "flv";
63
- }
64
- if (isRtm(url)) {
65
- return "rtm";
66
- }
67
- if (isMp4(url)) {
68
- return "mp4";
69
- }
70
- if (isDash(url)) {
71
- return "dash";
72
- }
73
- return "unknown";
74
- }
75
- const DynamicModule$3 = window["VePlayer"].DynamicModule;
76
- const load$3 = window["VePlayer"].load;
77
- const getAbrStrategy = async (options) => {
78
- var _a, _b;
79
- const streamType = options.url && getStreamType(options.url);
80
- if (streamType === "rtm") {
81
- return {};
82
- }
83
- const abrOptions = streamType === "flv" ? (_a = options == null ? void 0 : options.flv) == null ? void 0 : _a.abr : (_b = options == null ? void 0 : options.hls) == null ? void 0 : _b.abr;
84
- if (!abrOptions) {
85
- return {};
86
- }
87
- const abrPlugin = await load$3(DynamicModule$3.PluginAbr).catch(() => void 0);
88
- return {
89
- options: {
90
- [streamType === "flv" ? "abr" : "hlsabr"]: {
91
- ...abrOptions,
92
- open: abrOptions.enable ?? true
93
- }
94
- },
95
- plugins: [
96
- streamType === "flv" ? abrPlugin == null ? void 0 : abrPlugin.AbrPlugin : abrPlugin == null ? void 0 : abrPlugin.HlsAbrPlugin
97
- ]
98
- };
99
- };
100
43
  const strategy$1 = window["VePlayer"].strategy;
101
44
  const util$4 = window["VePlayer"].util;
102
- const DynamicModule$2 = window["VePlayer"].DynamicModule;
103
- const load$2 = window["VePlayer"].load;
45
+ const DynamicModule$3 = window["VePlayer"].DynamicModule;
46
+ const load$3 = window["VePlayer"].load;
104
47
  const Codec$1 = window["VePlayer"].Codec;
105
48
  const Sniffer$3 = window["VePlayer"].Sniffer;
106
49
  const rtmStrategy = {
107
50
  options: {},
108
- module: DynamicModule$2.PluginRtm
51
+ module: DynamicModule$3.PluginRtm
109
52
  };
110
53
  const generateFallbackUrl = (url) => {
111
54
  if (Sniffer$3.device === "pc") {
@@ -117,8 +60,6 @@ const generateFallbackUrl = (url) => {
117
60
  const getRtmStrategy = async (options, player) => {
118
61
  var _a;
119
62
  let backupStrategy;
120
- let backupOptions = {};
121
- let backupModule = [];
122
63
  const { url } = options;
123
64
  const {
124
65
  fallbackUrl,
@@ -133,28 +74,18 @@ const getRtmStrategy = async (options, player) => {
133
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$1.H264)) {
134
75
  backupStrategy = strategy$1.createHlsMseStrategy(options);
135
76
  }
136
- const [rtmCdn, backupCdn, backupAbr] = await Promise.all([
137
- load$2(rtmStrategy.module).then((module) => {
77
+ const [rtmCdn, backupCdn] = await Promise.all([
78
+ load$3(rtmStrategy.module).then((module) => {
138
79
  return module.RtmPlugin;
139
80
  }).catch(() => void 0),
140
- backupStrategy && load$2(backupStrategy.module).then((module) => {
141
- if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$2.PluginFlv) {
81
+ backupStrategy && load$3(backupStrategy.module).then((module) => {
82
+ if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$3.PluginFlv) {
142
83
  return module.FlvPlugin;
143
- } else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$2.PluginHls) {
84
+ } else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$3.PluginHls) {
144
85
  return module.HlsPlugin;
145
86
  }
146
- }).catch(() => void 0),
147
- getAbrStrategy({ ...options, url: actualFallbackUrl }).catch(
148
- () => void 0
149
- )
87
+ }).catch(() => void 0)
150
88
  ]);
151
- if (backupType) {
152
- backupOptions = {
153
- ...backupStrategy == null ? void 0 : backupStrategy.options,
154
- ...backupAbr == null ? void 0 : backupAbr.options
155
- };
156
- backupModule = [backupCdn, ...(backupAbr == null ? void 0 : backupAbr.plugins) ?? []];
157
- }
158
89
  const [RTMSupported, RTMSupportCodec] = await Promise.all([
159
90
  isRTMSupported(),
160
91
  isRTMSupportCodec()
@@ -172,7 +103,7 @@ const getRtmStrategy = async (options, player) => {
172
103
  }
173
104
  return {
174
105
  options: {
175
- ...backupOptions || {},
106
+ ...(backupStrategy == null ? void 0 : backupStrategy.options) || {},
176
107
  url: actualFallbackUrl,
177
108
  _RTMdegrade: {
178
109
  _originRtmUrl: url,
@@ -180,19 +111,19 @@ const getRtmStrategy = async (options, player) => {
180
111
  _isRTMSupportCodec: RTMSupportCodec
181
112
  }
182
113
  },
183
- plugins: backupModule
114
+ plugins: backupCdn ? [backupCdn] : []
184
115
  };
185
116
  }
186
117
  return {
187
118
  options: {
188
- ...backupOptions || {},
119
+ ...(backupStrategy == null ? void 0 : backupStrategy.options) || {},
189
120
  url: enableRTMAutoTranscode ? util$4.appendSearchParams(url, { enableRTMAutoTranscode: "true" }) : void 0,
190
121
  _RTMdegrade: void 0,
191
122
  rts: {
192
123
  retryCount: 0,
193
124
  ...ret,
194
125
  backupURL: actualFallbackUrl,
195
- backupConstruct: backupModule
126
+ backupConstruct: backupCdn
196
127
  }
197
128
  },
198
129
  plugins: rtmCdn ? [rtmCdn] : []
@@ -243,6 +174,10 @@ const getTypeStrategy = async (options, player) => {
243
174
  }
244
175
  return { options: {}, plugins: [] };
245
176
  };
177
+ var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {};
178
+ function getDefaultExportFromCjs(x2) {
179
+ return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
180
+ }
246
181
  var FUNC_ERROR_TEXT = "Expected a function";
247
182
  var NAN = 0 / 0;
248
183
  var symbolTag = "[object Symbol]";
@@ -3056,9 +2991,9 @@ class Logger extends Plugin$2 {
3056
2991
  device_id: this._deviceId,
3057
2992
  ext: {
3058
2993
  veplayer_version: "2.3.1-rc.1",
3059
- flv_version: "3.0.19-rc.10",
3060
- hls_version: "3.0.19-rc.0",
3061
- rts_version: "0.2.1-alpha.1"
2994
+ flv_version: "3.0.19-rc.0",
2995
+ hls_version: "3.0.20-alpha.2",
2996
+ rts_version: "0.2.1-alpha.0"
3062
2997
  }
3063
2998
  });
3064
2999
  }
@@ -3326,8 +3261,8 @@ const ZH_CN$1 = {
3326
3261
  DECODE_INFO: "软解信息",
3327
3262
  REFRESH: "刷新"
3328
3263
  };
3329
- const DynamicModule$1 = window["VePlayer"].DynamicModule;
3330
- const load$1 = window["VePlayer"].load;
3264
+ const DynamicModule$2 = window["VePlayer"].DynamicModule;
3265
+ const load$2 = window["VePlayer"].load;
3331
3266
  const getDrmStrategy = async (options, player) => {
3332
3267
  var _a;
3333
3268
  const drmType = getDrmType(options.drm);
@@ -3335,7 +3270,7 @@ const getDrmStrategy = async (options, player) => {
3335
3270
  try {
3336
3271
  const { getDrmConfig, ...originFairplayConfig } = ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) ?? {};
3337
3272
  const [drmPlugin, drmConfig] = await Promise.all([
3338
- load$1(DynamicModule$1.PluginDrm).then((module) => module.DrmPlugin).catch(() => void 0),
3273
+ load$2(DynamicModule$2.PluginDrm).then((module) => module.DrmPlugin).catch(() => void 0),
3339
3274
  getDrmConfig == null ? void 0 : getDrmConfig({
3340
3275
  url: options.url
3341
3276
  })
@@ -3359,6 +3294,59 @@ const getDrmStrategy = async (options, player) => {
3359
3294
  }
3360
3295
  return {};
3361
3296
  };
3297
+ function isType(suffix) {
3298
+ return function(url) {
3299
+ return url == null ? void 0 : url.split("?")[0].toLowerCase().includes(suffix);
3300
+ };
3301
+ }
3302
+ const isHls = isType(".m3u8");
3303
+ const isMp4 = isType(".mp4");
3304
+ const isFlv = isType(".flv");
3305
+ const isRtm = isType(".sdp");
3306
+ const isDash = isType(".mpd");
3307
+ function getStreamType(url) {
3308
+ if (isHls(url)) {
3309
+ return "hls";
3310
+ }
3311
+ if (isFlv(url)) {
3312
+ return "flv";
3313
+ }
3314
+ if (isRtm(url)) {
3315
+ return "rtm";
3316
+ }
3317
+ if (isMp4(url)) {
3318
+ return "mp4";
3319
+ }
3320
+ if (isDash(url)) {
3321
+ return "dash";
3322
+ }
3323
+ return "unknown";
3324
+ }
3325
+ const DynamicModule$1 = window["VePlayer"].DynamicModule;
3326
+ const load$1 = window["VePlayer"].load;
3327
+ const getAbrStrategy = async (options) => {
3328
+ var _a, _b;
3329
+ const streamType = options.url && getStreamType(options.url);
3330
+ if (streamType === "rtm") {
3331
+ return {};
3332
+ }
3333
+ const abrOptions = streamType === "flv" ? (_a = options == null ? void 0 : options.flv) == null ? void 0 : _a.abr : (_b = options == null ? void 0 : options.hls) == null ? void 0 : _b.abr;
3334
+ if (!abrOptions) {
3335
+ return {};
3336
+ }
3337
+ const abrPlugin = await load$1(DynamicModule$1.PluginAbr).catch(() => void 0);
3338
+ return {
3339
+ options: {
3340
+ [streamType === "flv" ? "abr" : "hlsabr"]: {
3341
+ ...abrOptions,
3342
+ open: abrOptions.enable ?? true
3343
+ }
3344
+ },
3345
+ plugins: [
3346
+ streamType === "flv" ? abrPlugin == null ? void 0 : abrPlugin.AbrPlugin : abrPlugin == null ? void 0 : abrPlugin.HlsAbrPlugin
3347
+ ]
3348
+ };
3349
+ };
3362
3350
  const DEFAULT_PLUGINS = window["VePlayer"].DEFAULT_PLUGINS;
3363
3351
  const VePlayerBase = window["VePlayer"].VePlayerBase;
3364
3352
  const VeI18n = window["VePlayer"].VeI18n;