@volcengine/veplayer 2.4.1-rc.0 → 2.5.0-rc.1

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