@byteplus/veplayer 2.3.1-rc.4 → 2.4.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.
Files changed (40) hide show
  1. package/esm/index.d.ts +17 -8
  2. package/esm/veplayer.biz.live.development.js +91 -20
  3. package/esm/veplayer.biz.live.production.js +1 -1
  4. package/esm/veplayer.d.ts +139 -16
  5. package/esm/veplayer.development.css +1 -1
  6. package/esm/veplayer.development.js +227 -101
  7. package/esm/veplayer.live.d.ts +139 -16
  8. package/esm/veplayer.live.development.css +1 -1
  9. package/esm/veplayer.live.development.js +227 -101
  10. package/esm/veplayer.live.production.css +1 -1
  11. package/esm/veplayer.live.production.js +3 -3
  12. package/esm/veplayer.production.css +1 -1
  13. package/esm/veplayer.production.js +3 -3
  14. package/esm/veplayer.vod.d.ts +17 -8
  15. package/esm/veplayer.vod.development.css +1 -1
  16. package/esm/veplayer.vod.development.js +168 -69
  17. package/esm/veplayer.vod.production.css +1 -1
  18. package/esm/veplayer.vod.production.js +2 -2
  19. package/package.json +1 -1
  20. package/umd/index.d.ts +17 -8
  21. package/umd/veplayer.biz.live.development.js +91 -20
  22. package/umd/veplayer.biz.live.production.js +1 -1
  23. package/umd/veplayer.d.ts +139 -16
  24. package/umd/veplayer.development.css +1 -1
  25. package/umd/veplayer.development.js +227 -101
  26. package/umd/veplayer.live.d.ts +139 -16
  27. package/umd/veplayer.live.development.css +1 -1
  28. package/umd/veplayer.live.development.js +227 -101
  29. package/umd/veplayer.live.production.css +1 -1
  30. package/umd/veplayer.live.production.js +1 -1
  31. package/umd/veplayer.production.css +1 -1
  32. package/umd/veplayer.production.js +1 -1
  33. package/umd/veplayer.vod.d.ts +17 -8
  34. package/umd/veplayer.vod.development.css +1 -1
  35. package/umd/veplayer.vod.development.js +168 -69
  36. package/umd/veplayer.vod.production.css +1 -1
  37. package/umd/veplayer.vod.production.js +1 -1
  38. package/veplayer.d.ts +139 -16
  39. package/veplayer.live.d.ts +139 -16
  40. package/veplayer.vod.d.ts +17 -8
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byteplus/veplayer",
3
- "version": "2.3.1-rc.4",
3
+ "version": "2.4.0-rc.0",
4
4
  "main": "./umd/veplayer.production.js",
5
5
  "module": "./esm/veplayer.production.js",
6
6
  "browser": "./umd/veplayer.production.js",
package/umd/index.d.ts CHANGED
@@ -2164,11 +2164,11 @@ declare enum DynamicModule {
2164
2164
  PluginFlv = "plugin:flv",
2165
2165
  PluginMp4 = "plugin:mp4",
2166
2166
  PluginHls = "plugin:hls",
2167
- PluginHlsJs = "plugin:hlsjs",
2168
2167
  PluginShaka = "plugin:shaka",
2169
2168
  PluginRtm = "plugin:rtm",
2170
2169
  PluginXgvideo = "plugin:xgvideo",
2171
- PluginDrm = "plugin:drm"
2170
+ PluginDrm = "plugin:drm",
2171
+ PluginAbr = "plugin:abr"
2172
2172
  }
2173
2173
  type ModulesMap = {
2174
2174
  [DynamicModule.BizVod]: Exports;
@@ -2176,11 +2176,11 @@ type ModulesMap = {
2176
2176
  [DynamicModule.PluginFlv]: Exports;
2177
2177
  [DynamicModule.PluginMp4]: Exports;
2178
2178
  [DynamicModule.PluginHls]: Exports;
2179
- [DynamicModule.PluginHlsJs]: Exports;
2180
2179
  [DynamicModule.PluginShaka]: Exports;
2181
2180
  [DynamicModule.PluginRtm]: Exports;
2182
2181
  [DynamicModule.PluginXgvideo]: Exports;
2183
2182
  [DynamicModule.PluginDrm]: Exports;
2183
+ [DynamicModule.PluginAbr]: Exports;
2184
2184
  };
2185
2185
  declare const register: (exports: {
2186
2186
  [x: string]: any;
@@ -3896,11 +3896,11 @@ declare namespace strategy {
3896
3896
  readonly "plugin:flv": "veplayer.plugin.flv.[env].[ext]";
3897
3897
  readonly "plugin:mp4": "veplayer.plugin.mp4.[env].[ext]";
3898
3898
  readonly "plugin:hls": "veplayer.plugin.hls.[env].[ext]";
3899
- readonly "plugin:hlsjs": "veplayer.plugin.hlsjs.[env].[ext]";
3900
3899
  readonly "plugin:shaka": "veplayer.plugin.shaka.[env].[ext]";
3901
3900
  readonly "plugin:rtm": "veplayer.plugin.rtm.[env].[ext]";
3902
3901
  readonly "plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]";
3903
3902
  readonly "plugin:drm": "veplayer.plugin.drm.[env].[ext]";
3903
+ readonly "plugin:abr": "veplayer.plugin.abr.[env].[ext]";
3904
3904
  };
3905
3905
  const enum State {
3906
3906
  Fetching = 0,
@@ -3927,11 +3927,11 @@ declare namespace strategy {
3927
3927
  PluginFlv = "plugin:flv",
3928
3928
  PluginMp4 = "plugin:mp4",
3929
3929
  PluginHls = "plugin:hls",
3930
- PluginHlsJs = "plugin:hlsjs",
3931
3930
  PluginShaka = "plugin:shaka",
3932
3931
  PluginRtm = "plugin:rtm",
3933
3932
  PluginXgvideo = "plugin:xgvideo",
3934
- PluginDrm = "plugin:drm"
3933
+ PluginDrm = "plugin:drm",
3934
+ PluginAbr = "plugin:abr"
3935
3935
  }
3936
3936
  type ModulesMap = {
3937
3937
  [DynamicModule.BizVod]: Exports;
@@ -3939,11 +3939,11 @@ declare namespace strategy {
3939
3939
  [DynamicModule.PluginFlv]: Exports;
3940
3940
  [DynamicModule.PluginMp4]: Exports;
3941
3941
  [DynamicModule.PluginHls]: Exports;
3942
- [DynamicModule.PluginHlsJs]: Exports;
3943
3942
  [DynamicModule.PluginShaka]: Exports;
3944
3943
  [DynamicModule.PluginRtm]: Exports;
3945
3944
  [DynamicModule.PluginXgvideo]: Exports;
3946
3945
  [DynamicModule.PluginDrm]: Exports;
3946
+ [DynamicModule.PluginAbr]: Exports;
3947
3947
  };
3948
3948
  class Loader {
3949
3949
  readonly modules: Record<string, Module>;
@@ -3981,7 +3981,7 @@ declare namespace strategy {
3981
3981
  }
3982
3982
  type StrategyCreator<T, R extends keyof ModulesMap = any> = (options?: T) => Strategy<T, R>;
3983
3983
  const createFlvMseStrategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginFlv>;
3984
- const createHlsMseStrategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginHls | DynamicModule.PluginHlsJs>;
3984
+ const createHlsMseStrategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginHls>;
3985
3985
  const createSoftDecodeH264Strategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginXgvideo>;
3986
3986
  const createSoftDecodeH265Strategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginXgvideo>;
3987
3987
  function getCodec(options: VePlayerBaseOptions): Promise<"unknown" | Codec>;
@@ -4607,6 +4607,9 @@ declare namespace event {
4607
4607
  AUTOPLAY_SUCCESS: string;
4608
4608
  ERROR_REFRESH_CLICK: string;
4609
4609
  SOURCE_CHANGE: string;
4610
+ SWITCH_DEFINITION_START: string;
4611
+ SWITCH_DEFINITION_SUCCESS: string;
4612
+ DOWN_DEFINITION: string;
4610
4613
  };
4611
4614
  const Events: {
4612
4615
  SEI: string;
@@ -4632,6 +4635,9 @@ declare namespace event {
4632
4635
  AUTOPLAY_SUCCESS: string;
4633
4636
  ERROR_REFRESH_CLICK: string;
4634
4637
  SOURCE_CHANGE: string;
4638
+ SWITCH_DEFINITION_START: string;
4639
+ SWITCH_DEFINITION_SUCCESS: string;
4640
+ DOWN_DEFINITION: string;
4635
4641
  REPLAY: string;
4636
4642
  ERROR: string;
4637
4643
  PLAY: string;
@@ -4663,6 +4669,9 @@ declare namespace event {
4663
4669
  COMPLETE: string;
4664
4670
  DESTROY: string;
4665
4671
  URL_CHANGE: string;
4672
+ LEAVE_PLAYER: string;
4673
+ ENTER_PLAYER: string;
4674
+ LOADING: string;
4666
4675
  SEI_PARSED: string;
4667
4676
  RETRY: string;
4668
4677
  ROTATE: string;
@@ -32,27 +32,27 @@ var __publicField = (obj, key, value) => {
32
32
  function create(errorCode, i18n) {
33
33
  return new VeError(ERRORS[errorCode], i18n);
34
34
  }
35
- const DynamicModule$3 = window["VePlayer"].DynamicModule;
36
- const load$3 = window["VePlayer"].load;
35
+ const DynamicModule$4 = window["VePlayer"].DynamicModule;
36
+ const load$4 = window["VePlayer"].load;
37
37
  async function isRTMSupported() {
38
- const { RtmPlugin } = await load$3(DynamicModule$3.PluginRtm);
38
+ const { RtmPlugin } = await load$4(DynamicModule$4.PluginRtm);
39
39
  return RtmPlugin.isSupported();
40
40
  }
41
41
  async function isRTMSupportCodec(codec = RTMCodec.H264) {
42
- const { RtmPlugin } = await load$3(DynamicModule$3.PluginRtm);
42
+ const { RtmPlugin } = await load$4(DynamicModule$4.PluginRtm);
43
43
  if (codec === RTMCodec.H264)
44
44
  return RtmPlugin.isSupportedH264();
45
45
  return false;
46
46
  }
47
47
  const strategy$1 = window["VePlayer"].strategy;
48
48
  const util$4 = window["VePlayer"].util;
49
- const DynamicModule$2 = window["VePlayer"].DynamicModule;
50
- const load$2 = window["VePlayer"].load;
49
+ const DynamicModule$3 = window["VePlayer"].DynamicModule;
50
+ const load$3 = window["VePlayer"].load;
51
51
  const Codec$1 = window["VePlayer"].Codec;
52
52
  const Sniffer$3 = window["VePlayer"].Sniffer;
53
53
  const rtmStrategy = {
54
54
  options: {},
55
- module: DynamicModule$2.PluginRtm
55
+ module: DynamicModule$3.PluginRtm
56
56
  };
57
57
  const generateFallbackUrl = (url) => {
58
58
  if (Sniffer$3.device === "pc") {
@@ -79,13 +79,13 @@ var __publicField = (obj, key, value) => {
79
79
  backupStrategy = strategy$1.createHlsMseStrategy(options);
80
80
  }
81
81
  const [rtmCdn, backupCdn] = await Promise.all([
82
- load$2(rtmStrategy.module).then((module2) => {
82
+ load$3(rtmStrategy.module).then((module2) => {
83
83
  return module2.RtmPlugin;
84
84
  }).catch(() => void 0),
85
- backupStrategy && load$2(backupStrategy.module).then((module2) => {
86
- 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) {
87
87
  return module2.FlvPlugin;
88
- } else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$2.PluginHls || (backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$2.PluginHlsJs) {
88
+ } else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$3.PluginHls) {
89
89
  return module2.HlsPlugin;
90
90
  }
91
91
  }).catch(() => void 0)
@@ -2935,8 +2935,8 @@ var __publicField = (obj, key, value) => {
2935
2935
  device_id: this._deviceId,
2936
2936
  ext: {
2937
2937
  veplayer_version: "2.3.1-rc.2",
2938
- flv_version: "3.0.15-alpha.2",
2939
- hls_version: "3.0.12",
2938
+ flv_version: "3.0.17",
2939
+ hls_version: "3.0.17",
2940
2940
  rts_version: "0.2.0-alpha.5"
2941
2941
  }
2942
2942
  });
@@ -3205,8 +3205,8 @@ var __publicField = (obj, key, value) => {
3205
3205
  DECODE_INFO: "软解信息",
3206
3206
  REFRESH: "刷新"
3207
3207
  };
3208
- const DynamicModule$1 = window["VePlayer"].DynamicModule;
3209
- const load$1 = window["VePlayer"].load;
3208
+ const DynamicModule$2 = window["VePlayer"].DynamicModule;
3209
+ const load$2 = window["VePlayer"].load;
3210
3210
  const getDrmStrategy = async (options, player) => {
3211
3211
  var _a;
3212
3212
  const drmType = getDrmType(options.drm);
@@ -3214,7 +3214,7 @@ var __publicField = (obj, key, value) => {
3214
3214
  try {
3215
3215
  const { getDrmConfig, ...originFairplayConfig } = ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) ?? {};
3216
3216
  const [drmPlugin, drmConfig] = await Promise.all([
3217
- load$1(DynamicModule$1.PluginDrm).then((module2) => module2.DrmPlugin).catch(() => void 0),
3217
+ load$2(DynamicModule$2.PluginDrm).then((module2) => module2.DrmPlugin).catch(() => void 0),
3218
3218
  getDrmConfig == null ? void 0 : getDrmConfig({
3219
3219
  url: options.url
3220
3220
  })
@@ -3238,6 +3238,55 @@ var __publicField = (obj, key, value) => {
3238
3238
  }
3239
3239
  return {};
3240
3240
  };
3241
+ function isType(suffix) {
3242
+ return function(url) {
3243
+ return url == null ? void 0 : url.split("?")[0].toLowerCase().includes(suffix);
3244
+ };
3245
+ }
3246
+ const isHls = isType(".m3u8");
3247
+ const isMp4 = isType(".mp4");
3248
+ const isFlv = isType(".flv");
3249
+ const isRtm = isType(".sdp");
3250
+ const isDash = isType(".mpd");
3251
+ function getStreamType(url) {
3252
+ if (isHls(url)) {
3253
+ return "hls";
3254
+ }
3255
+ if (isFlv(url)) {
3256
+ return "flv";
3257
+ }
3258
+ if (isRtm(url)) {
3259
+ return "rtm";
3260
+ }
3261
+ if (isMp4(url)) {
3262
+ return "mp4";
3263
+ }
3264
+ if (isDash(url)) {
3265
+ return "dash";
3266
+ }
3267
+ return "unknown";
3268
+ }
3269
+ const DynamicModule$1 = window["VePlayer"].DynamicModule;
3270
+ const load$1 = window["VePlayer"].load;
3271
+ const getAbrStrategy = async (options) => {
3272
+ var _a, _b;
3273
+ const streamType = options.url && getStreamType(options.url);
3274
+ if (streamType === "rtm")
3275
+ return {};
3276
+ 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;
3277
+ if (!abrOptions) {
3278
+ return {};
3279
+ }
3280
+ const abrPlugin = await load$1(DynamicModule$1.PluginAbr).catch(() => void 0);
3281
+ return {
3282
+ options: {
3283
+ [streamType === "flv" ? "abr" : "hlsabr"]: abrOptions
3284
+ },
3285
+ plugins: [
3286
+ streamType === "flv" ? abrPlugin == null ? void 0 : abrPlugin.AbrPlugin : abrPlugin == null ? void 0 : abrPlugin.HlsAbrPlugin
3287
+ ]
3288
+ };
3289
+ };
3241
3290
  const DEFAULT_PLUGINS = window["VePlayer"].DEFAULT_PLUGINS;
3242
3291
  const VePlayerBase = window["VePlayer"].VePlayerBase;
3243
3292
  const VeI18n = window["VePlayer"].VeI18n;
@@ -3313,6 +3362,14 @@ var __publicField = (obj, key, value) => {
3313
3362
  var _a;
3314
3363
  (_a = this._player.plugins) == null ? void 0 : _a.infopanel.close();
3315
3364
  }
3365
+ openAbr() {
3366
+ var _a, _b;
3367
+ (_b = (_a = this._player.plugins) == null ? void 0 : _a.abr) == null ? void 0 : _b.switchAbr(true);
3368
+ }
3369
+ closeAbr() {
3370
+ var _a, _b;
3371
+ (_b = (_a = this._player.plugins) == null ? void 0 : _a.abr) == null ? void 0 : _b.switchAbr(false);
3372
+ }
3316
3373
  /** {zh}
3317
3374
  * @brief 调用此方法更新 DRM 鉴权配置。
3318
3375
  * @hidden
@@ -3321,6 +3378,14 @@ var __publicField = (obj, key, value) => {
3321
3378
  var _a, _b, _c;
3322
3379
  (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config);
3323
3380
  }
3381
+ async switch(target, options) {
3382
+ var _a, _b, _c;
3383
+ const { abr, ...rest } = options ?? {};
3384
+ if (abr) {
3385
+ (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.abr) == null ? void 0 : _c.updateConfig(abr);
3386
+ }
3387
+ return super.switch(target, rest);
3388
+ }
3324
3389
  }
3325
3390
  async function createLivePlayer(options) {
3326
3391
  var _a, _b;
@@ -3345,15 +3410,21 @@ var __publicField = (obj, key, value) => {
3345
3410
  };
3346
3411
  },
3347
3412
  async preparePlugins(url) {
3348
- const [typeStrategy, drmStrategy] = await Promise.all([
3413
+ const [typeStrategy, drmStrategy, abrStrategy] = await Promise.all([
3349
3414
  getTypeStrategy({ ...finalOptions, url }, player),
3350
- getDrmStrategy({ ...finalOptions, url }, player)
3415
+ getDrmStrategy({ ...finalOptions, url }, player),
3416
+ getAbrStrategy({ ...finalOptions, url })
3351
3417
  ]);
3352
3418
  const { options: options2, plugins } = typeStrategy ?? {};
3353
3419
  const { options: drmOptions, plugins: drmPlugins } = drmStrategy ?? {};
3420
+ const { options: abrOptions, plugins: abrPlugins } = abrStrategy ?? {};
3354
3421
  return {
3355
- options: Object.assign({}, options2, drmOptions),
3356
- plugins: [...plugins ?? [], ...drmPlugins ?? []]
3422
+ options: Object.assign({}, options2, drmOptions, abrOptions),
3423
+ plugins: [
3424
+ ...plugins ?? [],
3425
+ ...drmPlugins ?? [],
3426
+ ...abrPlugins ?? []
3427
+ ]
3357
3428
  };
3358
3429
  }
3359
3430
  },