@volcengine/veplayer 2.8.0-rc.2 → 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.2";
14563
+ return "2.8.0";
14458
14564
  }
14459
14565
  /** {zh}
14460
14566
  * @brief 获取当前播放视频的清晰度唯一标识(definition)。
@@ -14975,7 +15081,9 @@ class VePlayerBase {
14975
15081
  if (!url2) {
14976
15082
  const transformedError = transform$1(err, this._i18nManager);
14977
15083
  try {
14978
- const { canEmitError } = await this._beforeFallbackError(transformedError);
15084
+ const { canEmitError } = await this._beforeFallbackError(
15085
+ transformedError
15086
+ );
14979
15087
  if (!canEmitError) {
14980
15088
  return;
14981
15089
  }
@@ -15011,7 +15119,7 @@ class VePlayerBase {
15011
15119
  return transform(event, callback);
15012
15120
  }
15013
15121
  async _switch(targetDefinition) {
15014
- var _a, _b, _c, _d, _e2, _f;
15122
+ var _a, _b, _c, _d, _e2, _f, _g, _h;
15015
15123
  const preDefinition = clonedeep(this._sourceManager.definition);
15016
15124
  const isPaused = this._player.paused && !this._player.isError;
15017
15125
  const {
@@ -15024,9 +15132,9 @@ class VePlayerBase {
15024
15132
  targetDefinition.url = options == null ? void 0 : options.url;
15025
15133
  }
15026
15134
  this._sourceManager.switch(targetDefinition);
15027
- (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.sources.renderItemList();
15028
- (_d = (_c = this._player) == null ? void 0 : _c.plugins) == null ? void 0 : _d.definition.renderItemList();
15029
- 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);
15030
15138
  this._player.config.url = targetDefinition.url;
15031
15139
  if (isSameProtocol) {
15032
15140
  if (isSourceSwitching) {
@@ -21939,10 +22047,10 @@ let Logger$1 = class Logger extends Plugin {
21939
22047
  device_id: (_f = (_e2 = this.player.config) == null ? void 0 : _e2.teaTracker) == null ? void 0 : _f.deviceId,
21940
22048
  error_report_stop: true,
21941
22049
  ext: {
21942
- veplayer_version: "2.8.0-rc.2",
22050
+ veplayer_version: "2.8.0",
21943
22051
  flv_version: "3.0.21-rc.21",
21944
22052
  hls_version: "3.0.21-rc.21",
21945
- rts_version: "0.2.1-alpha.30"
22053
+ rts_version: "0.2.1-alpha.35"
21946
22054
  }
21947
22055
  });
21948
22056
  }
@@ -22316,7 +22424,22 @@ const LiveUrlType = {
22316
22424
  LLHls: "ll-hls",
22317
22425
  Flv: "flv",
22318
22426
  Rtm: "rtm",
22319
- 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"
22320
22443
  };
22321
22444
  const { isMMSSupported, isMseSupported: isMseSupported$1 } = util;
22322
22445
  function enableMMS() {
@@ -22480,6 +22603,9 @@ class FlvProtocol extends BaseProtocol {
22480
22603
  getVeStrategy() {
22481
22604
  return void 0;
22482
22605
  }
22606
+ updateDrmConfig() {
22607
+ return void 0;
22608
+ }
22483
22609
  }
22484
22610
  class FlvLowLatencyProtocol extends FlvProtocol {
22485
22611
  get protocolType() {
@@ -22495,47 +22621,54 @@ class FlvLowLatencyProtocol extends FlvProtocol {
22495
22621
  });
22496
22622
  }
22497
22623
  }
22498
- var DrmType = /* @__PURE__ */ ((DrmType2) => {
22499
- DrmType2["Fairplay"] = "fairplay";
22500
- return DrmType2;
22501
- })(DrmType || {});
22502
- function getDrmType(drm) {
22503
- if ((drm == null ? void 0 : drm.fairplay) && (sniffer$1.browser === "safari" || sniffer$1.os.isIos)) {
22504
- return "fairplay";
22505
- }
22506
- 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);
22507
22627
  }
22508
- function isMseSupportedWithDrm({
22509
- drm,
22510
- streamType
22511
- }) {
22512
- const drmType = getDrmType(drm);
22513
- if (!drmType) {
22514
- return true;
22515
- }
22516
- if (drmType === "fairplay" && streamType === "hls") {
22628
+ function enableMse(options) {
22629
+ var _a;
22630
+ if (preferNativeForFairplay(options)) {
22517
22631
  return false;
22518
22632
  }
22519
- return true;
22633
+ return sniffer$1.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE);
22520
22634
  }
22521
- const { isMseSupported } = util;
22522
22635
  function enableHlsJs(options) {
22523
- var _a, _b;
22524
- 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") {
22525
22641
  return true;
22526
22642
  }
22527
- if (((_b = options == null ? void 0 : options.ad) == null ? void 0 : _b.adType) === "ssai") {
22643
+ if (options.drm) {
22528
22644
  return true;
22529
22645
  }
22530
22646
  return false;
22531
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;
22532
22668
  const getHlsStrategy = async (options) => {
22533
- var _a, _b;
22669
+ var _a;
22534
22670
  let mseStrategy;
22535
22671
  let softStrategy;
22536
- if (!isMseSupportedWithDrm({ drm: options.drm, streamType: "hls" })) {
22537
- return { options: {}, plugins: [] };
22538
- }
22539
22672
  const codec = await getCodec(options);
22540
22673
  const isSoftDecode$1 = await isSoftDecode(options, codec);
22541
22674
  const useHlsJs = enableHlsJs(options);
@@ -22543,7 +22676,7 @@ const getHlsStrategy = async (options) => {
22543
22676
  softStrategy = codec === Codec$1.H265 ? createSoftDecodeH265Strategy() : createSoftDecodeH264Strategy();
22544
22677
  mseStrategy = createHlsMseStrategy(options, useHlsJs);
22545
22678
  }
22546
- 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))) {
22547
22680
  mseStrategy = createHlsMseStrategy(options, useHlsJs);
22548
22681
  }
22549
22682
  if (!mseStrategy && !softStrategy) {
@@ -22553,7 +22686,7 @@ const getHlsStrategy = async (options) => {
22553
22686
  (mseStrategy == null ? void 0 : mseStrategy.module) && load(mseStrategy.module).catch(() => void 0),
22554
22687
  (softStrategy == null ? void 0 : softStrategy.module) && load(softStrategy.module).catch(() => void 0)
22555
22688
  ]);
22556
- (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));
22557
22690
  const combineOptions$1 = combineOptions([mseStrategy, softStrategy]);
22558
22691
  return {
22559
22692
  options: combineOptions$1,
@@ -22624,37 +22757,6 @@ function modifyPlaylistUrl(playlist, callback) {
22624
22757
  });
22625
22758
  return newPlaylist;
22626
22759
  }
22627
- const getDrmStrategy = async (options, player) => {
22628
- var _a;
22629
- const drmType = getDrmType(options.drm);
22630
- if (options.url && drmType === DrmType.Fairplay) {
22631
- try {
22632
- const { getDrmConfig, ...originFairplayConfig } = ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) ?? {};
22633
- const [drmPlugin, drmConfig] = await Promise.all([
22634
- load(DynamicModule.PluginDrm).then((module) => module.DrmPlugin).catch(() => void 0),
22635
- getDrmConfig == null ? void 0 : getDrmConfig({
22636
- url: options.url
22637
- })
22638
- ]);
22639
- const fairplayDrmConfig = Object.assign(
22640
- {},
22641
- originFairplayConfig,
22642
- options == null ? void 0 : options.drm,
22643
- drmConfig
22644
- );
22645
- drmConfig && (player == null ? void 0 : player.updateDrmConfig(drmConfig));
22646
- return {
22647
- options: {
22648
- drm: fairplayDrmConfig
22649
- },
22650
- plugins: drmPlugin ? [drmPlugin] : []
22651
- };
22652
- } catch (error2) {
22653
- console.log(error2);
22654
- }
22655
- }
22656
- return {};
22657
- };
22658
22760
  class HlsProtocol extends BaseProtocol {
22659
22761
  static get suffix() {
22660
22762
  return ".m3u8";
@@ -22711,14 +22813,58 @@ class HlsProtocol extends BaseProtocol {
22711
22813
  plugins: [abrPlugin == null ? void 0 : abrPlugin.HlsAbrPlugin]
22712
22814
  };
22713
22815
  }
22714
- getDrmStrategy(options, { player }) {
22715
- 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 {};
22716
22862
  }
22717
22863
  getVeStrategy() {
22718
22864
  return void 0;
22719
22865
  }
22720
22866
  }
22721
- class HlsLowLatencyProtocol extends BaseProtocol {
22867
+ class HlsLowLatencyProtocol extends HlsProtocol {
22722
22868
  static get suffix() {
22723
22869
  return ".m3u8";
22724
22870
  }
@@ -22743,12 +22889,6 @@ class HlsLowLatencyProtocol extends BaseProtocol {
22743
22889
  async getProtocolStrategy(options) {
22744
22890
  return getHlsStrategy(options);
22745
22891
  }
22746
- getAbrStrategy() {
22747
- return void 0;
22748
- }
22749
- getDrmStrategy() {
22750
- return void 0;
22751
- }
22752
22892
  getVeStrategy() {
22753
22893
  return void 0;
22754
22894
  }
@@ -22938,6 +23078,9 @@ class RtmProtocol extends BaseProtocol {
22938
23078
  plugins: []
22939
23079
  };
22940
23080
  }
23081
+ updateDrmConfig() {
23082
+ return void 0;
23083
+ }
22941
23084
  }
22942
23085
  class ProtocolSelector {
22943
23086
  constructor({ queue, streams, options }) {
@@ -23707,6 +23850,97 @@ lodash_merge.exports;
23707
23850
  })(lodash_merge, lodash_merge.exports);
23708
23851
  var lodash_mergeExports = lodash_merge.exports;
23709
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
+ }
23710
23944
  const _ProtocolManager = class {
23711
23945
  constructor(options) {
23712
23946
  __publicField(this, "_options");
@@ -23861,7 +24095,8 @@ __publicField(ProtocolManager, "_protocolMap", {
23861
24095
  [LiveUrlType.LLFlv]: FlvLowLatencyProtocol,
23862
24096
  [LiveUrlType.Hls]: HlsProtocol,
23863
24097
  [LiveUrlType.LLHls]: HlsLowLatencyProtocol,
23864
- [LiveUrlType.Rtm]: RtmProtocol
24098
+ [LiveUrlType.Rtm]: RtmProtocol,
24099
+ [LiveUrlType.Dash]: DashProtocol
23865
24100
  });
23866
24101
  class Fallback {
23867
24102
  constructor() {
@@ -41599,9 +41834,9 @@ class VePlayerLive extends VePlayerBase {
41599
41834
  * @brief Use this method to update DRM configuration.
41600
41835
  * @param config A configuration object containing settings for Fairplay DRM.
41601
41836
  */
41602
- updateDrmConfig(config2) {
41603
- var _a, _b, _c;
41604
- (_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);
41605
41840
  }
41606
41841
  /** {zh}
41607
41842
  * @brief 修改 ABR 配置,包含修改是否开启 ABR 功能,和修改其他清晰度。