@volcengine/veplayer 2.8.0-rc.1 → 2.8.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.
@@ -6539,11 +6539,20 @@ var ErrorCode$1 = /* @__PURE__ */ ((ErrorCode2) => {
6539
6539
  ErrorCode2[ErrorCode2["MEDIA_MSE_HIJACK"] = 5204] = "MEDIA_MSE_HIJACK";
6540
6540
  ErrorCode2[ErrorCode2["MEDIA_EME_HIJACK"] = 5301] = "MEDIA_EME_HIJACK";
6541
6541
  ErrorCode2[ErrorCode2["DRM_LICENSE"] = 7100] = "DRM_LICENSE";
6542
+ ErrorCode2[ErrorCode2["DRM_UNSUPPORTED"] = 7101] = "DRM_UNSUPPORTED";
6543
+ ErrorCode2[ErrorCode2["DRM_NO_MEDIA_KEY"] = 7103] = "DRM_NO_MEDIA_KEY";
6544
+ ErrorCode2[ErrorCode2["DRM_NO_KEY_SESSION"] = 7104] = "DRM_NO_KEY_SESSION";
6545
+ ErrorCode2[ErrorCode2["DRM_GENERATE_QUEST_FAIL"] = 7105] = "DRM_GENERATE_QUEST_FAIL";
6546
+ ErrorCode2[ErrorCode2["DRM_LACK_SERVER_CERTIFICATE_PATH"] = 7106] = "DRM_LACK_SERVER_CERTIFICATE_PATH";
6547
+ ErrorCode2[ErrorCode2["DRM_LACK_SERVER_PROCESS_SPC_PATH"] = 7107] = "DRM_LACK_SERVER_PROCESS_SPC_PATH";
6548
+ ErrorCode2[ErrorCode2["DRM_LICENSE_FAIL"] = 7108] = "DRM_LICENSE_FAIL";
6549
+ ErrorCode2[ErrorCode2["DRM_KEY_ERROR"] = 7109] = "DRM_KEY_ERROR";
6550
+ ErrorCode2[ErrorCode2["DRM_CERT_FAIL"] = 7110] = "DRM_CERT_FAIL";
6542
6551
  ErrorCode2[ErrorCode2["DRM_CUSTOM_LICENSE"] = 7200] = "DRM_CUSTOM_LICENSE";
6543
6552
  ErrorCode2[ErrorCode2["OTHER"] = 8e3] = "OTHER";
6544
6553
  ErrorCode2[ErrorCode2["RUNTIME_NO_CANPLAY_ERROR"] = 9001] = "RUNTIME_NO_CANPLAY_ERROR";
6545
6554
  ErrorCode2[ErrorCode2["RUNTIME_BUFFERBREAK_ERROR"] = 9002] = "RUNTIME_BUFFERBREAK_ERROR";
6546
- ErrorCode2[ErrorCode2["RUNTIME_BWAITING_TIMEOUT_ERROR"] = 9002] = "RUNTIME_BWAITING_TIMEOUT_ERROR";
6555
+ ErrorCode2[ErrorCode2["RUNTIME_WAITING_TIMEOUT_ERROR"] = 9003] = "RUNTIME_WAITING_TIMEOUT_ERROR";
6547
6556
  ErrorCode2[ErrorCode2["MODULE_LOAD_ERROR"] = 110] = "MODULE_LOAD_ERROR";
6548
6557
  ErrorCode2["UNKNOWN"] = "UNKNOWN";
6549
6558
  return ErrorCode2;
@@ -6655,6 +6664,78 @@ const ERROR_INFO = {
6655
6664
  messageTextKey: "DRM_LICENSE",
6656
6665
  level: "Fatal"
6657
6666
  /* Fatal */
6667
+ },
6668
+ [
6669
+ 7101
6670
+ /* DRM_UNSUPPORTED */
6671
+ ]: {
6672
+ messageTextKey: "DRM_UNSUPPORTED",
6673
+ level: "Fatal"
6674
+ /* Fatal */
6675
+ },
6676
+ [
6677
+ 7103
6678
+ /* DRM_NO_MEDIA_KEY */
6679
+ ]: {
6680
+ messageTextKey: "DRM_NO_MEDIA_KEY",
6681
+ level: "Fatal"
6682
+ /* Fatal */
6683
+ },
6684
+ [
6685
+ 7104
6686
+ /* DRM_NO_KEY_SESSION */
6687
+ ]: {
6688
+ messageTextKey: "DRM_NO_KEY_SESSION",
6689
+ level: "Fatal"
6690
+ /* Fatal */
6691
+ },
6692
+ [
6693
+ 7105
6694
+ /* DRM_GENERATE_QUEST_FAIL */
6695
+ ]: {
6696
+ messageTextKey: "DRM_GENERATE_QUEST_FAIL",
6697
+ level: "Fatal"
6698
+ /* Fatal */
6699
+ },
6700
+ [
6701
+ 7106
6702
+ /* DRM_LACK_SERVER_CERTIFICATE_PATH */
6703
+ ]: {
6704
+ messageTextKey: "DRM_LACK_SERVER_CERTIFICATE_PATH",
6705
+ level: "Fatal"
6706
+ /* Fatal */
6707
+ },
6708
+ [
6709
+ 7107
6710
+ /* DRM_LACK_SERVER_PROCESS_SPC_PATH */
6711
+ ]: {
6712
+ messageTextKey: "DRM_LACK_SERVER_PROCESS_SPC_PATH",
6713
+ level: "Fatal"
6714
+ /* Fatal */
6715
+ },
6716
+ [
6717
+ 7108
6718
+ /* DRM_LICENSE_FAIL */
6719
+ ]: {
6720
+ messageTextKey: "DRM_LICENSE_FAIL",
6721
+ level: "Fatal"
6722
+ /* Fatal */
6723
+ },
6724
+ [
6725
+ 7109
6726
+ /* DRM_KEY_ERROR */
6727
+ ]: {
6728
+ messageTextKey: "DRM_KEY_ERROR",
6729
+ level: "Fatal"
6730
+ /* Fatal */
6731
+ },
6732
+ [
6733
+ 7110
6734
+ /* DRM_CERT_FAIL */
6735
+ ]: {
6736
+ messageTextKey: "DRM_CERT_FAIL",
6737
+ level: "Fatal"
6738
+ /* Fatal */
6658
6739
  }
6659
6740
  };
6660
6741
  const ERROR_TYPE_INFO = {
@@ -12717,6 +12798,7 @@ const NAME_MAP = {
12717
12798
  "plugin:mp4": "veplayer.plugin.mp4.[env].[ext]",
12718
12799
  "plugin:hls": "veplayer.plugin.hls.[env].[ext]",
12719
12800
  "plugin:hlsjs": "veplayer.plugin.hlsjs.[env].[ext]",
12801
+ "plugin:dashjs": "veplayer.plugin.dashjs.[env].[ext]",
12720
12802
  "plugin:shaka": "veplayer.plugin.shaka.[env].[ext]",
12721
12803
  "plugin:rtm": "veplayer.plugin.rtm.[env].[ext]",
12722
12804
  "plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]",
@@ -12732,6 +12814,7 @@ var DynamicModule = /* @__PURE__ */ ((DynamicModule2) => {
12732
12814
  DynamicModule2["PluginMp4"] = "plugin:mp4";
12733
12815
  DynamicModule2["PluginHls"] = "plugin:hls";
12734
12816
  DynamicModule2["PluginHlsJs"] = "plugin:hlsjs";
12817
+ DynamicModule2["PluginDashJs"] = "plugin:dashjs";
12735
12818
  DynamicModule2["PluginShaka"] = "plugin:shaka";
12736
12819
  DynamicModule2["PluginRtm"] = "plugin:rtm";
12737
12820
  DynamicModule2["PluginXgvideo"] = "plugin:xgvideo";
@@ -14076,6 +14159,15 @@ const EN$1 = {
14076
14159
  MEDIA_ERR_URL_EMPTY: "The stream address is not specified",
14077
14160
  DRM: "Permission verification failed",
14078
14161
  DRM_LICENSE: "Commercial DRM Permission verification failed",
14162
+ DRM_UNSUPPORTED: "DRM encrypted playback is not supported",
14163
+ DRM_NO_MEDIA_KEY: "Video data lacks the corresponding MediaKey",
14164
+ DRM_NO_KEY_SESSION: "Browser does not support the corresponding DRM KeySession",
14165
+ DRM_GENERATE_QUEST_FAIL: "Decryption playback error",
14166
+ DRM_LACK_SERVER_CERTIFICATE_PATH: "Missing DRM certificate request link",
14167
+ DRM_LACK_SERVER_PROCESS_SPC_PATH: "Missing DRM License request link",
14168
+ DRM_LICENSE_FAIL: "Request or update License failed",
14169
+ DRM_KEY_ERROR: "Decryption error",
14170
+ DRM_CERT_FAIL: "Request for DRM certificate failed",
14079
14171
  OTHER: "Unknown error",
14080
14172
  RUNTIME: "An error occurred, Please try again",
14081
14173
  MODULE_LOAD_ERROR: "CDN fetch error",
@@ -14103,6 +14195,15 @@ const ZH_CN$1 = {
14103
14195
  MEDIA_ERR_URL_EMPTY: "当前播放地址为空",
14104
14196
  DRM: "权限验证失败",
14105
14197
  DRM_LICENSE: "商业 DRM LICENSE 鉴权失败",
14198
+ DRM_UNSUPPORTED: "不支持 DRM 加密播放",
14199
+ DRM_NO_MEDIA_KEY: "视频数据缺少相应 MediaKey",
14200
+ DRM_NO_KEY_SESSION: "浏览器不支持相应 DRM KeySession",
14201
+ DRM_GENERATE_QUEST_FAIL: "解密播放错误",
14202
+ DRM_LACK_SERVER_CERTIFICATE_PATH: "缺少 DRM 证书请求链接",
14203
+ DRM_LACK_SERVER_PROCESS_SPC_PATH: "缺少 DRM License 请求链接",
14204
+ DRM_LICENSE_FAIL: "请求或更新 License 失败",
14205
+ DRM_KEY_ERROR: "解密错误",
14206
+ DRM_CERT_FAIL: "请求 DRM 证书失败",
14106
14207
  OTHER: "其他报错",
14107
14208
  RUNTIME: "播放异常,请重试",
14108
14209
  MODULE_LOAD_ERROR: "插件模块加载异常",
@@ -14199,10 +14300,15 @@ const transformOption = (
14199
14300
  * @param options 更多配置信息。
14200
14301
  */
14201
14302
  (options) => {
14303
+ var _a, _b;
14202
14304
  const { autoplay: autoplay2, ...rest } = options;
14203
14305
  const xgOptions = rest;
14204
14306
  if (xgOptions.poster) {
14205
- xgOptions.poster = escapeHtml(xgOptions.poster);
14307
+ if (typeof xgOptions.poster === "string") {
14308
+ xgOptions.poster = escapeHtml(xgOptions.poster);
14309
+ } else if (typeof ((_a = xgOptions.poster) == null ? void 0 : _a.poster) === "string") {
14310
+ xgOptions.poster.poster = escapeHtml((_b = xgOptions.poster) == null ? void 0 : _b.poster);
14311
+ }
14206
14312
  }
14207
14313
  xgOptions.icons = {
14208
14314
  ...DEFAULT_ICONS,
@@ -14454,7 +14560,7 @@ class VePlayerBase {
14454
14560
  * @brief Retrieve the player SDK version number.
14455
14561
  */
14456
14562
  get playerVersion() {
14457
- return "2.8.0-rc.1";
14563
+ return "2.8.0";
14458
14564
  }
14459
14565
  /** {zh}
14460
14566
  * @brief 获取当前播放视频的清晰度唯一标识(definition)。
@@ -14729,7 +14835,7 @@ class VePlayerBase {
14729
14835
  }
14730
14836
  }
14731
14837
  /** {zh}
14732
- * @brief 调用此方法开始播放 。
14838
+ * @brief 调用此方法开始播放。
14733
14839
  */
14734
14840
  /** {en}
14735
14841
  * @brief Starts playback.
@@ -15013,7 +15119,7 @@ class VePlayerBase {
15013
15119
  return transform(event, callback);
15014
15120
  }
15015
15121
  async _switch(targetDefinition) {
15016
- var _a, _b, _c, _d, _e2, _f;
15122
+ var _a, _b, _c, _d, _e2, _f, _g, _h;
15017
15123
  const preDefinition = clonedeep(this._sourceManager.definition);
15018
15124
  const isPaused = this._player.paused && !this._player.isError;
15019
15125
  const {
@@ -15026,9 +15132,9 @@ class VePlayerBase {
15026
15132
  targetDefinition.url = options == null ? void 0 : options.url;
15027
15133
  }
15028
15134
  this._sourceManager.switch(targetDefinition);
15029
- (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.sources.renderItemList();
15030
- (_d = (_c = this._player) == null ? void 0 : _c.plugins) == null ? void 0 : _d.definition.renderItemList();
15031
- const isSourceSwitching = ((_e2 = targetDefinition == null ? void 0 : targetDefinition.source) == null ? void 0 : _e2.name) !== ((_f = preDefinition == null ? void 0 : preDefinition.source) == null ? void 0 : _f.name);
15135
+ (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.sources) == null ? void 0 : _c.renderItemList();
15136
+ (_f = (_e2 = (_d = this._player) == null ? void 0 : _d.plugins) == null ? void 0 : _e2.definition) == null ? void 0 : _f.renderItemList();
15137
+ const isSourceSwitching = ((_g = targetDefinition == null ? void 0 : targetDefinition.source) == null ? void 0 : _g.name) !== ((_h = preDefinition == null ? void 0 : preDefinition.source) == null ? void 0 : _h.name);
15032
15138
  this._player.config.url = targetDefinition.url;
15033
15139
  if (isSameProtocol) {
15034
15140
  if (isSourceSwitching) {
@@ -21941,10 +22047,10 @@ let Logger$1 = class Logger extends Plugin {
21941
22047
  device_id: (_f = (_e2 = this.player.config) == null ? void 0 : _e2.teaTracker) == null ? void 0 : _f.deviceId,
21942
22048
  error_report_stop: true,
21943
22049
  ext: {
21944
- veplayer_version: "2.8.0-rc.1",
22050
+ veplayer_version: "2.8.0",
21945
22051
  flv_version: "3.0.21-rc.21",
21946
22052
  hls_version: "3.0.21-rc.21",
21947
- rts_version: "0.2.1-alpha.29"
22053
+ rts_version: "0.2.1-alpha.35"
21948
22054
  }
21949
22055
  });
21950
22056
  }
@@ -22318,7 +22424,22 @@ const LiveUrlType = {
22318
22424
  LLHls: "ll-hls",
22319
22425
  Flv: "flv",
22320
22426
  Rtm: "rtm",
22321
- LLFlv: "ll-flv"
22427
+ LLFlv: "ll-flv",
22428
+ Dash: "dash"
22429
+ };
22430
+ const KeyNameMap = {
22431
+ [
22432
+ "widevine"
22433
+ /* Widevine */
22434
+ ]: "com.widevine.alpha",
22435
+ [
22436
+ "playready"
22437
+ /* Playready */
22438
+ ]: "com.microsoft.playready",
22439
+ [
22440
+ "fairplay"
22441
+ /* Fairplay */
22442
+ ]: "com.apple.fps"
22322
22443
  };
22323
22444
  const { isMMSSupported, isMseSupported: isMseSupported$1 } = util;
22324
22445
  function enableMMS() {
@@ -22482,6 +22603,9 @@ class FlvProtocol extends BaseProtocol {
22482
22603
  getVeStrategy() {
22483
22604
  return void 0;
22484
22605
  }
22606
+ updateDrmConfig() {
22607
+ return void 0;
22608
+ }
22485
22609
  }
22486
22610
  class FlvLowLatencyProtocol extends FlvProtocol {
22487
22611
  get protocolType() {
@@ -22497,47 +22621,54 @@ class FlvLowLatencyProtocol extends FlvProtocol {
22497
22621
  });
22498
22622
  }
22499
22623
  }
22500
- var DrmType = /* @__PURE__ */ ((DrmType2) => {
22501
- DrmType2["Fairplay"] = "fairplay";
22502
- return DrmType2;
22503
- })(DrmType || {});
22504
- function getDrmType(drm) {
22505
- if ((drm == null ? void 0 : drm.fairplay) && (sniffer$1.browser === "safari" || sniffer$1.os.isIos)) {
22506
- return "fairplay";
22507
- }
22508
- return;
22624
+ function preferNativeForFairplay(options) {
22625
+ var _a;
22626
+ return ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) && (sniffer$1.browser === "safari" || sniffer$1.os.isIos);
22509
22627
  }
22510
- function isMseSupportedWithDrm({
22511
- drm,
22512
- streamType
22513
- }) {
22514
- const drmType = getDrmType(drm);
22515
- if (!drmType) {
22516
- return true;
22517
- }
22518
- if (drmType === "fairplay" && streamType === "hls") {
22628
+ function enableMse(options) {
22629
+ var _a;
22630
+ if (preferNativeForFairplay(options)) {
22519
22631
  return false;
22520
22632
  }
22521
- return true;
22633
+ return sniffer$1.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE);
22522
22634
  }
22523
- const { isMseSupported } = util;
22524
22635
  function enableHlsJs(options) {
22525
- var _a, _b;
22526
- if ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableHlsJs) {
22636
+ var _a, _b, _c;
22637
+ if (typeof ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableHlsJs) !== "undefined") {
22638
+ return (_b = options.hls) == null ? void 0 : _b.enableHlsJs;
22639
+ }
22640
+ if (((_c = options == null ? void 0 : options.ad) == null ? void 0 : _c.adType) === "ssai") {
22527
22641
  return true;
22528
22642
  }
22529
- if (((_b = options == null ? void 0 : options.ad) == null ? void 0 : _b.adType) === "ssai") {
22643
+ if (options.drm) {
22530
22644
  return true;
22531
22645
  }
22532
22646
  return false;
22533
22647
  }
22648
+ function transformHlsDrmConfig(drmConfig) {
22649
+ const drmSystems = {};
22650
+ for (const key in drmConfig) {
22651
+ if (drmConfig.hasOwnProperty(key)) {
22652
+ const drmSystemKey = KeyNameMap[key];
22653
+ const drmSystemUrls = drmConfig[key];
22654
+ if (drmSystemKey && drmSystemUrls) {
22655
+ drmSystems[drmSystemKey] = {
22656
+ licenseUrl: drmSystemUrls == null ? void 0 : drmSystemUrls.serverProcessSPCPath,
22657
+ serverCertificateUrl: drmSystemUrls == null ? void 0 : drmSystemUrls.serverCertificatePath
22658
+ };
22659
+ }
22660
+ }
22661
+ }
22662
+ return {
22663
+ emeEnabled: true,
22664
+ drmSystems
22665
+ };
22666
+ }
22667
+ const { isMseSupported } = util;
22534
22668
  const getHlsStrategy = async (options) => {
22535
- var _a, _b;
22669
+ var _a;
22536
22670
  let mseStrategy;
22537
22671
  let softStrategy;
22538
- if (!isMseSupportedWithDrm({ drm: options.drm, streamType: "hls" })) {
22539
- return { options: {}, plugins: [] };
22540
- }
22541
22672
  const codec = await getCodec(options);
22542
22673
  const isSoftDecode$1 = await isSoftDecode(options, codec);
22543
22674
  const useHlsJs = enableHlsJs(options);
@@ -22545,7 +22676,7 @@ const getHlsStrategy = async (options) => {
22545
22676
  softStrategy = codec === Codec$1.H265 ? createSoftDecodeH265Strategy() : createSoftDecodeH264Strategy();
22546
22677
  mseStrategy = createHlsMseStrategy(options, useHlsJs);
22547
22678
  }
22548
- if ((sniffer$1.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE)) && (codec === "unknown" ? isMseSupported(Codec$1.H264) : isMseSupported(codec))) {
22679
+ if (enableMse(options) && (codec === "unknown" ? isMseSupported(Codec$1.H264) : isMseSupported(codec))) {
22549
22680
  mseStrategy = createHlsMseStrategy(options, useHlsJs);
22550
22681
  }
22551
22682
  if (!mseStrategy && !softStrategy) {
@@ -22555,7 +22686,7 @@ const getHlsStrategy = async (options) => {
22555
22686
  (mseStrategy == null ? void 0 : mseStrategy.module) && load(mseStrategy.module).catch(() => void 0),
22556
22687
  (softStrategy == null ? void 0 : softStrategy.module) && load(softStrategy.module).catch(() => void 0)
22557
22688
  ]);
22558
- (softModule == null ? void 0 : softModule.XGVideoPlugin) && ((_b = softStrategy == null ? void 0 : softStrategy.afterLoad) == null ? void 0 : _b.call(softStrategy, softModule == null ? void 0 : softModule.XGVideoPlugin));
22689
+ (softModule == null ? void 0 : softModule.XGVideoPlugin) && ((_a = softStrategy == null ? void 0 : softStrategy.afterLoad) == null ? void 0 : _a.call(softStrategy, softModule == null ? void 0 : softModule.XGVideoPlugin));
22559
22690
  const combineOptions$1 = combineOptions([mseStrategy, softStrategy]);
22560
22691
  return {
22561
22692
  options: combineOptions$1,
@@ -22626,37 +22757,6 @@ function modifyPlaylistUrl(playlist, callback) {
22626
22757
  });
22627
22758
  return newPlaylist;
22628
22759
  }
22629
- const getDrmStrategy = async (options, player) => {
22630
- var _a;
22631
- const drmType = getDrmType(options.drm);
22632
- if (options.url && drmType === DrmType.Fairplay) {
22633
- try {
22634
- const { getDrmConfig, ...originFairplayConfig } = ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) ?? {};
22635
- const [drmPlugin, drmConfig] = await Promise.all([
22636
- load(DynamicModule.PluginDrm).then((module) => module.DrmPlugin).catch(() => void 0),
22637
- getDrmConfig == null ? void 0 : getDrmConfig({
22638
- url: options.url
22639
- })
22640
- ]);
22641
- const fairplayDrmConfig = Object.assign(
22642
- {},
22643
- originFairplayConfig,
22644
- options == null ? void 0 : options.drm,
22645
- drmConfig
22646
- );
22647
- drmConfig && (player == null ? void 0 : player.updateDrmConfig(drmConfig));
22648
- return {
22649
- options: {
22650
- drm: fairplayDrmConfig
22651
- },
22652
- plugins: drmPlugin ? [drmPlugin] : []
22653
- };
22654
- } catch (error2) {
22655
- console.log(error2);
22656
- }
22657
- }
22658
- return {};
22659
- };
22660
22760
  class HlsProtocol extends BaseProtocol {
22661
22761
  static get suffix() {
22662
22762
  return ".m3u8";
@@ -22713,14 +22813,58 @@ class HlsProtocol extends BaseProtocol {
22713
22813
  plugins: [abrPlugin == null ? void 0 : abrPlugin.HlsAbrPlugin]
22714
22814
  };
22715
22815
  }
22716
- getDrmStrategy(options, { player }) {
22717
- return getDrmStrategy(options, player);
22816
+ async updateDrmConfig(drmConfig, player) {
22817
+ var _a, _b, _c, _d;
22818
+ if (!drmConfig) {
22819
+ return;
22820
+ }
22821
+ const drmPlugin = (_b = (_a = player == null ? void 0 : player._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm;
22822
+ const hlsPlugin = (_d = (_c = player == null ? void 0 : player._player) == null ? void 0 : _c.plugins) == null ? void 0 : _d.hls;
22823
+ if (drmPlugin) {
22824
+ drmPlugin.restart();
22825
+ return drmPlugin.updateConfig(drmConfig);
22826
+ } else if (hlsPlugin) {
22827
+ hlsPlugin.config = {
22828
+ ...hlsPlugin.config,
22829
+ ...transformHlsDrmConfig(drmConfig)
22830
+ };
22831
+ }
22832
+ }
22833
+ async getDrmStrategy(options, { player }) {
22834
+ try {
22835
+ if (!(options == null ? void 0 : options.drm)) {
22836
+ return { options: {}, plugins: [] };
22837
+ }
22838
+ const drmConfig = (options == null ? void 0 : options.drm) ?? {};
22839
+ if (!preferNativeForFairplay(options) && enableHlsJs(options)) {
22840
+ return {
22841
+ options: {
22842
+ hls: {
22843
+ ...options.hls,
22844
+ ...transformHlsDrmConfig(drmConfig)
22845
+ }
22846
+ },
22847
+ plugins: []
22848
+ };
22849
+ }
22850
+ const drmPlugin = await load(DynamicModule.PluginDrm).then((module) => module.DrmPlugin).catch(() => void 0);
22851
+ drmConfig && await (player == null ? void 0 : player.updateDrmConfig(drmConfig));
22852
+ return {
22853
+ options: {
22854
+ drm: drmConfig
22855
+ },
22856
+ plugins: drmPlugin ? [drmPlugin] : []
22857
+ };
22858
+ } catch (error2) {
22859
+ console.log(error2);
22860
+ }
22861
+ return {};
22718
22862
  }
22719
22863
  getVeStrategy() {
22720
22864
  return void 0;
22721
22865
  }
22722
22866
  }
22723
- class HlsLowLatencyProtocol extends BaseProtocol {
22867
+ class HlsLowLatencyProtocol extends HlsProtocol {
22724
22868
  static get suffix() {
22725
22869
  return ".m3u8";
22726
22870
  }
@@ -22745,12 +22889,6 @@ class HlsLowLatencyProtocol extends BaseProtocol {
22745
22889
  async getProtocolStrategy(options) {
22746
22890
  return getHlsStrategy(options);
22747
22891
  }
22748
- getAbrStrategy() {
22749
- return void 0;
22750
- }
22751
- getDrmStrategy() {
22752
- return void 0;
22753
- }
22754
22892
  getVeStrategy() {
22755
22893
  return void 0;
22756
22894
  }
@@ -22940,6 +23078,9 @@ class RtmProtocol extends BaseProtocol {
22940
23078
  plugins: []
22941
23079
  };
22942
23080
  }
23081
+ updateDrmConfig() {
23082
+ return void 0;
23083
+ }
22943
23084
  }
22944
23085
  class ProtocolSelector {
22945
23086
  constructor({ queue, streams, options }) {
@@ -23709,6 +23850,97 @@ lodash_merge.exports;
23709
23850
  })(lodash_merge, lodash_merge.exports);
23710
23851
  var lodash_mergeExports = lodash_merge.exports;
23711
23852
  var merge = /* @__PURE__ */ getDefaultExportFromCjs$1(lodash_mergeExports);
23853
+ const createDashMseStrategy = () => ({
23854
+ options: {},
23855
+ module: DynamicModule.PluginDashJs
23856
+ });
23857
+ function isDASHSupported(codec = Codec$1.H264) {
23858
+ return isMMSSupported$1(codec) || isMseSupported$2(codec);
23859
+ }
23860
+ class DashProtocol extends BaseProtocol {
23861
+ static get suffix() {
23862
+ return ".mpd";
23863
+ }
23864
+ get protocolType() {
23865
+ return LiveUrlType.Dash;
23866
+ }
23867
+ get defaultFallbackStrategy() {
23868
+ return {};
23869
+ }
23870
+ static canGenerateOtherProtocol() {
23871
+ return true;
23872
+ }
23873
+ static generateUrl(urls, {
23874
+ generateUrlFromOtherProtocol: generateUrlFromOtherProtocol2
23875
+ }) {
23876
+ return urls[LiveUrlType.Dash] ?? generateUrlFromOtherProtocol2();
23877
+ }
23878
+ async canPlay() {
23879
+ return {
23880
+ canPlay: isDASHSupported()
23881
+ };
23882
+ }
23883
+ shouldFallbackWhenStall() {
23884
+ return false;
23885
+ }
23886
+ async getProtocolStrategy(options) {
23887
+ const mseStrategy = createDashMseStrategy();
23888
+ if (!mseStrategy) {
23889
+ return {};
23890
+ }
23891
+ const mseModule = await ((mseStrategy == null ? void 0 : mseStrategy.module) && load(mseStrategy.module).catch(() => void 0));
23892
+ return {
23893
+ options: mseStrategy.options,
23894
+ plugins: (mseModule == null ? void 0 : mseModule.DashPlugin) ? [mseModule.DashPlugin] : []
23895
+ };
23896
+ }
23897
+ getAbrStrategy() {
23898
+ return void 0;
23899
+ }
23900
+ getVeStrategy() {
23901
+ return void 0;
23902
+ }
23903
+ async getDrmStrategy(options) {
23904
+ if (!(options == null ? void 0 : options.drm)) {
23905
+ return {};
23906
+ }
23907
+ const dashDrm = this._generateDashDrmConfig(options.drm);
23908
+ return {
23909
+ options: {
23910
+ dash: {
23911
+ ...options.dash,
23912
+ protData: dashDrm
23913
+ }
23914
+ },
23915
+ plugins: []
23916
+ };
23917
+ }
23918
+ updateDrmConfig(drm, player) {
23919
+ var _a, _b;
23920
+ if (!drm) {
23921
+ return;
23922
+ }
23923
+ const dashDrm = this._generateDashDrmConfig(drm);
23924
+ const dashPlugin = (_b = (_a = player == null ? void 0 : player._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.dash;
23925
+ if (dashPlugin) {
23926
+ dashPlugin.protData = dashDrm;
23927
+ }
23928
+ }
23929
+ _generateDashDrmConfig(drm) {
23930
+ return Object.keys(drm).reduce((pre, cur) => {
23931
+ var _a;
23932
+ const keyName = KeyNameMap[cur];
23933
+ if (keyName) {
23934
+ pre[keyName] = {
23935
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
23936
+ // @ts-ignore
23937
+ serverURL: (_a = drm == null ? void 0 : drm[cur]) == null ? void 0 : _a.serverProcessSPCPath
23938
+ };
23939
+ }
23940
+ return pre;
23941
+ }, {});
23942
+ }
23943
+ }
23712
23944
  const _ProtocolManager = class {
23713
23945
  constructor(options) {
23714
23946
  __publicField(this, "_options");
@@ -23863,7 +24095,8 @@ __publicField(ProtocolManager, "_protocolMap", {
23863
24095
  [LiveUrlType.LLFlv]: FlvLowLatencyProtocol,
23864
24096
  [LiveUrlType.Hls]: HlsProtocol,
23865
24097
  [LiveUrlType.LLHls]: HlsLowLatencyProtocol,
23866
- [LiveUrlType.Rtm]: RtmProtocol
24098
+ [LiveUrlType.Rtm]: RtmProtocol,
24099
+ [LiveUrlType.Dash]: DashProtocol
23867
24100
  });
23868
24101
  class Fallback {
23869
24102
  constructor() {
@@ -36932,7 +37165,7 @@ class VeStrategyManager {
36932
37165
  }
36933
37166
  const { appId, deviceId, Module } = this.config;
36934
37167
  if (appId && deviceId && Module) {
36935
- await Module.bootstrap({
37168
+ Module.bootstrap({
36936
37169
  ...this.config,
36937
37170
  tracker: {
36938
37171
  Collector: this.Collector,
@@ -41479,6 +41712,12 @@ class VePlayerLive extends VePlayerBase {
41479
41712
  */
41480
41713
  constructor(options) {
41481
41714
  super(options);
41715
+ /** {en}
41716
+ * @hidden
41717
+ */
41718
+ /** {zh}
41719
+ * @hidden
41720
+ */
41482
41721
  __publicField(this, "_protocolManager");
41483
41722
  }
41484
41723
  /** {zh}
@@ -41589,14 +41828,15 @@ class VePlayerLive extends VePlayerBase {
41589
41828
  }
41590
41829
  /** {zh}
41591
41830
  * @brief 调用此方法更新 DRM 配置。
41831
+ * @param config DRM 配置对象,包含 Fairplay DRM 的相关设置。
41592
41832
  */
41593
41833
  /** {en}
41594
41834
  * @brief Use this method to update DRM configuration.
41595
- * @param config
41835
+ * @param config A configuration object containing settings for Fairplay DRM.
41596
41836
  */
41597
- updateDrmConfig(config2) {
41598
- var _a, _b, _c;
41599
- (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config2);
41837
+ async updateDrmConfig(config2) {
41838
+ var _a, _b;
41839
+ return (_b = (_a = this._protocolManager) == null ? void 0 : _a.protocol) == null ? void 0 : _b.updateDrmConfig(config2, this);
41600
41840
  }
41601
41841
  /** {zh}
41602
41842
  * @brief 修改 ABR 配置,包含修改是否开启 ABR 功能,和修改其他清晰度。
@@ -41670,10 +41910,29 @@ class VePlayerLive extends VePlayerBase {
41670
41910
  var _a, _b, _c;
41671
41911
  return (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.hls) == null ? void 0 : _c.getStats();
41672
41912
  }
41913
+ /** {en}
41914
+ * @brief This method is used to update the playlist, supporting updates to source, resolution, and related information.
41915
+ * @param playlist The playlist, consisting of multiple `Source` type elements.
41916
+ * @param target An optional target configuration, which can specify the resolution or source. Providing this information helps update the playback source for a specific resolution or stream.
41917
+ * @param needUpdateProtocol Whether the protocol needs to be updated.
41918
+ *
41919
+ * - `true`: Forces the protocol update to ensure compatibility with the playback configuration or source.
41920
+ * - `false`: Does not update the protocol and continues to use the current configuration.
41921
+ */
41922
+ /** {zh}
41923
+ * @brief 调用此方法更新播放列表,支持更新源、清晰度等相关信息。
41924
+ * @param playlist 播放列表,包含多个 `Source` 类型的元素。
41925
+ * @param target 可选的目标配置项,可以指定清晰度或源。提供这些信息可以帮助更新特定清晰度或线路的播放源。
41926
+ * @param needUpdateProtocol 是否需要更新协议。
41927
+ * - `true`:强制更新协议,以确保播放配置或源的兼容性。
41928
+ * - `false`:不更新协议,继续使用当前配置。
41929
+ */
41673
41930
  async updatePlaylist(playlist, target, needUpdateProtocol = true) {
41674
41931
  var _a;
41675
41932
  if (needUpdateProtocol) {
41676
- await ((_a = this._protocolManager) == null ? void 0 : _a.update({ playlist }));
41933
+ await ((_a = this._protocolManager) == null ? void 0 : _a.update({
41934
+ playlist
41935
+ }));
41677
41936
  }
41678
41937
  return super.updatePlaylist(playlist, target);
41679
41938
  }
@@ -41713,7 +41972,9 @@ async function createLivePlayer(options) {
41713
41972
  teaTracker,
41714
41973
  preProcessUrl: (url2) => {
41715
41974
  if (isType(".ts", url2)) {
41716
- return { url: url2 };
41975
+ return {
41976
+ url: url2
41977
+ };
41717
41978
  }
41718
41979
  return {
41719
41980
  url: generateUrlWithSessionId(url2)
@@ -41721,7 +41982,9 @@ async function createLivePlayer(options) {
41721
41982
  },
41722
41983
  async preparePlugins(url2) {
41723
41984
  if (!protocolManager.enableSelector) {
41724
- await protocolManager.update({ url: url2 });
41985
+ await protocolManager.update({
41986
+ url: url2
41987
+ });
41725
41988
  }
41726
41989
  return protocolManager.getStrategy(
41727
41990
  player,