@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.
@@ -195,7 +195,7 @@ function RefreshIcon() {
195
195
  }
196
196
  var refresh = "";
197
197
  const Plugin$3 = window["VePlayer"].Plugin;
198
- const Sniffer$5 = window["VePlayer"].Sniffer;
198
+ const Sniffer$4 = window["VePlayer"].Sniffer;
199
199
  const XGEvents = window["VePlayer"].XGEvents;
200
200
  const { POSITIONS: POSITIONS$1 } = Plugin$3;
201
201
  class Refresh extends Plugin$3 {
@@ -259,7 +259,7 @@ class Refresh extends Plugin$3 {
259
259
  }
260
260
  _initEvents() {
261
261
  this._handleRefresh = debounce$1(this._handleRefresh.bind(this), 200);
262
- const event2 = Sniffer$5.device === "mobile" ? "touchend" : "click";
262
+ const event2 = Sniffer$4.device === "mobile" ? "touchend" : "click";
263
263
  this.bind(event2, this._handleRefresh);
264
264
  this.show();
265
265
  }
@@ -2215,10 +2215,10 @@ let Logger$1 = class Logger extends Plugin$2 {
2215
2215
  device_id: (_f = (_e2 = this.player.config) == null ? void 0 : _e2.teaTracker) == null ? void 0 : _f.deviceId,
2216
2216
  error_report_stop: true,
2217
2217
  ext: {
2218
- veplayer_version: "2.3.1-rc.1",
2218
+ veplayer_version: "2.3.0",
2219
2219
  flv_version: "3.0.21-rc.21",
2220
2220
  hls_version: "3.0.21-rc.21",
2221
- rts_version: "0.2.1-alpha.30"
2221
+ rts_version: "0.2.1-alpha.35"
2222
2222
  }
2223
2223
  });
2224
2224
  }
@@ -2600,6 +2600,7 @@ const NAME_MAP = {
2600
2600
  "plugin:mp4": "veplayer.plugin.mp4.[env].[ext]",
2601
2601
  "plugin:hls": "veplayer.plugin.hls.[env].[ext]",
2602
2602
  "plugin:hlsjs": "veplayer.plugin.hlsjs.[env].[ext]",
2603
+ "plugin:dashjs": "veplayer.plugin.dashjs.[env].[ext]",
2603
2604
  "plugin:shaka": "veplayer.plugin.shaka.[env].[ext]",
2604
2605
  "plugin:rtm": "veplayer.plugin.rtm.[env].[ext]",
2605
2606
  "plugin:xgvideo": "veplayer.plugin.xgvideo.[env].[ext]",
@@ -2615,6 +2616,7 @@ var DynamicModule$7 = /* @__PURE__ */ ((DynamicModule2) => {
2615
2616
  DynamicModule2["PluginMp4"] = "plugin:mp4";
2616
2617
  DynamicModule2["PluginHls"] = "plugin:hls";
2617
2618
  DynamicModule2["PluginHlsJs"] = "plugin:hlsjs";
2619
+ DynamicModule2["PluginDashJs"] = "plugin:dashjs";
2618
2620
  DynamicModule2["PluginShaka"] = "plugin:shaka";
2619
2621
  DynamicModule2["PluginRtm"] = "plugin:rtm";
2620
2622
  DynamicModule2["PluginXgvideo"] = "plugin:xgvideo";
@@ -4687,11 +4689,20 @@ var ErrorCode = /* @__PURE__ */ ((ErrorCode2) => {
4687
4689
  ErrorCode2[ErrorCode2["MEDIA_MSE_HIJACK"] = 5204] = "MEDIA_MSE_HIJACK";
4688
4690
  ErrorCode2[ErrorCode2["MEDIA_EME_HIJACK"] = 5301] = "MEDIA_EME_HIJACK";
4689
4691
  ErrorCode2[ErrorCode2["DRM_LICENSE"] = 7100] = "DRM_LICENSE";
4692
+ ErrorCode2[ErrorCode2["DRM_UNSUPPORTED"] = 7101] = "DRM_UNSUPPORTED";
4693
+ ErrorCode2[ErrorCode2["DRM_NO_MEDIA_KEY"] = 7103] = "DRM_NO_MEDIA_KEY";
4694
+ ErrorCode2[ErrorCode2["DRM_NO_KEY_SESSION"] = 7104] = "DRM_NO_KEY_SESSION";
4695
+ ErrorCode2[ErrorCode2["DRM_GENERATE_QUEST_FAIL"] = 7105] = "DRM_GENERATE_QUEST_FAIL";
4696
+ ErrorCode2[ErrorCode2["DRM_LACK_SERVER_CERTIFICATE_PATH"] = 7106] = "DRM_LACK_SERVER_CERTIFICATE_PATH";
4697
+ ErrorCode2[ErrorCode2["DRM_LACK_SERVER_PROCESS_SPC_PATH"] = 7107] = "DRM_LACK_SERVER_PROCESS_SPC_PATH";
4698
+ ErrorCode2[ErrorCode2["DRM_LICENSE_FAIL"] = 7108] = "DRM_LICENSE_FAIL";
4699
+ ErrorCode2[ErrorCode2["DRM_KEY_ERROR"] = 7109] = "DRM_KEY_ERROR";
4700
+ ErrorCode2[ErrorCode2["DRM_CERT_FAIL"] = 7110] = "DRM_CERT_FAIL";
4690
4701
  ErrorCode2[ErrorCode2["DRM_CUSTOM_LICENSE"] = 7200] = "DRM_CUSTOM_LICENSE";
4691
4702
  ErrorCode2[ErrorCode2["OTHER"] = 8e3] = "OTHER";
4692
4703
  ErrorCode2[ErrorCode2["RUNTIME_NO_CANPLAY_ERROR"] = 9001] = "RUNTIME_NO_CANPLAY_ERROR";
4693
4704
  ErrorCode2[ErrorCode2["RUNTIME_BUFFERBREAK_ERROR"] = 9002] = "RUNTIME_BUFFERBREAK_ERROR";
4694
- ErrorCode2[ErrorCode2["RUNTIME_BWAITING_TIMEOUT_ERROR"] = 9002] = "RUNTIME_BWAITING_TIMEOUT_ERROR";
4705
+ ErrorCode2[ErrorCode2["RUNTIME_WAITING_TIMEOUT_ERROR"] = 9003] = "RUNTIME_WAITING_TIMEOUT_ERROR";
4695
4706
  ErrorCode2[ErrorCode2["MODULE_LOAD_ERROR"] = 110] = "MODULE_LOAD_ERROR";
4696
4707
  ErrorCode2["UNKNOWN"] = "UNKNOWN";
4697
4708
  return ErrorCode2;
@@ -4792,6 +4803,78 @@ const ERROR_INFO = {
4792
4803
  messageTextKey: "DRM_LICENSE",
4793
4804
  level: "Fatal"
4794
4805
  /* Fatal */
4806
+ },
4807
+ [
4808
+ 7101
4809
+ /* DRM_UNSUPPORTED */
4810
+ ]: {
4811
+ messageTextKey: "DRM_UNSUPPORTED",
4812
+ level: "Fatal"
4813
+ /* Fatal */
4814
+ },
4815
+ [
4816
+ 7103
4817
+ /* DRM_NO_MEDIA_KEY */
4818
+ ]: {
4819
+ messageTextKey: "DRM_NO_MEDIA_KEY",
4820
+ level: "Fatal"
4821
+ /* Fatal */
4822
+ },
4823
+ [
4824
+ 7104
4825
+ /* DRM_NO_KEY_SESSION */
4826
+ ]: {
4827
+ messageTextKey: "DRM_NO_KEY_SESSION",
4828
+ level: "Fatal"
4829
+ /* Fatal */
4830
+ },
4831
+ [
4832
+ 7105
4833
+ /* DRM_GENERATE_QUEST_FAIL */
4834
+ ]: {
4835
+ messageTextKey: "DRM_GENERATE_QUEST_FAIL",
4836
+ level: "Fatal"
4837
+ /* Fatal */
4838
+ },
4839
+ [
4840
+ 7106
4841
+ /* DRM_LACK_SERVER_CERTIFICATE_PATH */
4842
+ ]: {
4843
+ messageTextKey: "DRM_LACK_SERVER_CERTIFICATE_PATH",
4844
+ level: "Fatal"
4845
+ /* Fatal */
4846
+ },
4847
+ [
4848
+ 7107
4849
+ /* DRM_LACK_SERVER_PROCESS_SPC_PATH */
4850
+ ]: {
4851
+ messageTextKey: "DRM_LACK_SERVER_PROCESS_SPC_PATH",
4852
+ level: "Fatal"
4853
+ /* Fatal */
4854
+ },
4855
+ [
4856
+ 7108
4857
+ /* DRM_LICENSE_FAIL */
4858
+ ]: {
4859
+ messageTextKey: "DRM_LICENSE_FAIL",
4860
+ level: "Fatal"
4861
+ /* Fatal */
4862
+ },
4863
+ [
4864
+ 7109
4865
+ /* DRM_KEY_ERROR */
4866
+ ]: {
4867
+ messageTextKey: "DRM_KEY_ERROR",
4868
+ level: "Fatal"
4869
+ /* Fatal */
4870
+ },
4871
+ [
4872
+ 7110
4873
+ /* DRM_CERT_FAIL */
4874
+ ]: {
4875
+ messageTextKey: "DRM_CERT_FAIL",
4876
+ level: "Fatal"
4877
+ /* Fatal */
4795
4878
  }
4796
4879
  };
4797
4880
  class VeError extends Error {
@@ -4869,11 +4952,11 @@ async function load$9(name, src2) {
4869
4952
  });
4870
4953
  }
4871
4954
  }
4872
- var Codec$6 = /* @__PURE__ */ ((Codec2) => {
4955
+ var Codec$7 = /* @__PURE__ */ ((Codec2) => {
4873
4956
  Codec2["H265"] = "h265";
4874
4957
  Codec2["H264"] = "h264";
4875
4958
  return Codec2;
4876
- })(Codec$6 || {});
4959
+ })(Codec$7 || {});
4877
4960
  const appendSearchParams$1 = (url2, searchParams) => {
4878
4961
  var _a, _b;
4879
4962
  const urlObject = getUrlObject(url2);
@@ -4976,11 +5059,11 @@ function getStreamType(url2) {
4976
5059
  }
4977
5060
  return "unknown";
4978
5061
  }
4979
- function isMseSupported$3(codec = Codec$6.H264) {
4980
- if (codec === Codec$6.H265) {
5062
+ function isMseSupported$3(codec = Codec$7.H264) {
5063
+ if (codec === Codec$7.H265) {
4981
5064
  return sniffer.isHevcSupported();
4982
5065
  }
4983
- if (codec === Codec$6.H264) {
5066
+ if (codec === Codec$7.H264) {
4984
5067
  return sniffer.isMSESupport();
4985
5068
  }
4986
5069
  return sniffer.isMSESupport(codec);
@@ -4989,14 +5072,14 @@ async function isSoftDecodeSupported$1() {
4989
5072
  const { XGVideoPlugin } = await load$9(DynamicModule$7.PluginXgvideo);
4990
5073
  return XGVideoPlugin == null ? void 0 : XGVideoPlugin.isSupported();
4991
5074
  }
4992
- function isMMSSupported$2(codec = Codec$6.H264) {
5075
+ function isMMSSupported$2(codec = Codec$7.H264) {
4993
5076
  if (typeof window.ManagedMediaSource === "undefined") {
4994
5077
  return false;
4995
5078
  }
4996
- if (codec === Codec$6.H264) {
5079
+ if (codec === Codec$7.H264) {
4997
5080
  return window.ManagedMediaSource.isTypeSupported(H264_MIME);
4998
5081
  }
4999
- if (codec === Codec$6.H265) {
5082
+ if (codec === Codec$7.H265) {
5000
5083
  return H265_MIME.some((mine) => {
5001
5084
  return window.ManagedMediaSource.isTypeSupported(mine);
5002
5085
  });
@@ -5018,16 +5101,37 @@ const LiveUrlType = {
5018
5101
  LLHls: "ll-hls",
5019
5102
  Flv: "flv",
5020
5103
  Rtm: "rtm",
5021
- LLFlv: "ll-flv"
5104
+ LLFlv: "ll-flv",
5105
+ Dash: "dash"
5022
5106
  };
5023
- const Sniffer$4 = window["VePlayer"].Sniffer;
5024
- const Codec$5 = window["VePlayer"].Codec;
5107
+ var DrmType = /* @__PURE__ */ ((DrmType2) => {
5108
+ DrmType2["Widevine"] = "widevine";
5109
+ DrmType2["Fairplay"] = "fairplay";
5110
+ DrmType2["Playready"] = "playready";
5111
+ return DrmType2;
5112
+ })(DrmType || {});
5113
+ const KeyNameMap = {
5114
+ [
5115
+ "widevine"
5116
+ /* Widevine */
5117
+ ]: "com.widevine.alpha",
5118
+ [
5119
+ "playready"
5120
+ /* Playready */
5121
+ ]: "com.microsoft.playready",
5122
+ [
5123
+ "fairplay"
5124
+ /* Fairplay */
5125
+ ]: "com.apple.fps"
5126
+ };
5127
+ const Sniffer$3 = window["VePlayer"].Sniffer;
5128
+ const Codec$6 = window["VePlayer"].Codec;
5025
5129
  const util$5 = window["VePlayer"].util;
5026
5130
  const { isMMSSupported: isMMSSupported$1, isMseSupported: isMseSupported$2 } = util$5;
5027
5131
  function enableMMS() {
5028
- return Sniffer$4.os.isIos;
5132
+ return Sniffer$3.os.isIos;
5029
5133
  }
5030
- function isFLVSupported(codec = Codec$5.H264) {
5134
+ function isFLVSupported(codec = Codec$6.H264) {
5031
5135
  const isMediaSourceSupported = enableMMS() ? isMMSSupported$1 : isMseSupported$2;
5032
5136
  return isMediaSourceSupported(codec);
5033
5137
  }
@@ -5082,7 +5186,7 @@ class BaseProtocol {
5082
5186
  }
5083
5187
  const strategy$2 = window["VePlayer"].strategy;
5084
5188
  const load$8 = window["VePlayer"].load;
5085
- const Codec$4 = window["VePlayer"].Codec;
5189
+ const Codec$5 = window["VePlayer"].Codec;
5086
5190
  const util$4 = window["VePlayer"].util;
5087
5191
  const { appendSearchParams } = util$4;
5088
5192
  const getFlvStrategy = async (options) => {
@@ -5095,10 +5199,10 @@ const getFlvStrategy = async (options) => {
5095
5199
  const codec = await strategy$2.getCodec(options);
5096
5200
  const isSoftDecode = await strategy$2.isSoftDecode(options, codec);
5097
5201
  if (isSoftDecode) {
5098
- softStrategy = codec === Codec$4.H265 ? strategy$2.createSoftDecodeH265Strategy() : strategy$2.createSoftDecodeH264Strategy();
5202
+ softStrategy = codec === Codec$5.H265 ? strategy$2.createSoftDecodeH265Strategy() : strategy$2.createSoftDecodeH264Strategy();
5099
5203
  mseStrategy = strategy$2.createFlvMseStrategy(options);
5100
5204
  }
5101
- if (codec === "unknown" ? isFLVSupported(Codec$4.H264) : isFLVSupported(codec)) {
5205
+ if (codec === "unknown" ? isFLVSupported(Codec$5.H264) : isFLVSupported(codec)) {
5102
5206
  mseStrategy = enableMMS() ? strategy$2.createFlvMssStrategy(options) : strategy$2.createFlvMseStrategy(options);
5103
5207
  }
5104
5208
  if (!mseStrategy && !softStrategy) {
@@ -5191,6 +5295,9 @@ class FlvProtocol extends BaseProtocol {
5191
5295
  getVeStrategy() {
5192
5296
  return void 0;
5193
5297
  }
5298
+ updateDrmConfig() {
5299
+ return void 0;
5300
+ }
5194
5301
  }
5195
5302
  class FlvLowLatencyProtocol extends FlvProtocol {
5196
5303
  get protocolType() {
@@ -5206,61 +5313,67 @@ class FlvLowLatencyProtocol extends FlvProtocol {
5206
5313
  });
5207
5314
  }
5208
5315
  }
5209
- const Sniffer$3 = window["VePlayer"].Sniffer;
5210
- var DrmType = /* @__PURE__ */ ((DrmType2) => {
5211
- DrmType2["Fairplay"] = "fairplay";
5212
- return DrmType2;
5213
- })(DrmType || {});
5214
- function getDrmType(drm) {
5215
- if ((drm == null ? void 0 : drm.fairplay) && (Sniffer$3.browser === "safari" || Sniffer$3.os.isIos)) {
5216
- return "fairplay";
5217
- }
5218
- return;
5316
+ const Sniffer$2 = window["VePlayer"].Sniffer;
5317
+ function preferNativeForFairplay(options) {
5318
+ var _a;
5319
+ return ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) && (Sniffer$2.browser === "safari" || Sniffer$2.os.isIos);
5219
5320
  }
5220
- function isMseSupportedWithDrm({
5221
- drm,
5222
- streamType
5223
- }) {
5224
- const drmType = getDrmType(drm);
5225
- if (!drmType) {
5226
- return true;
5227
- }
5228
- if (drmType === "fairplay" && streamType === "hls") {
5321
+ function enableMse(options) {
5322
+ var _a;
5323
+ if (preferNativeForFairplay(options)) {
5229
5324
  return false;
5230
5325
  }
5231
- return true;
5326
+ return Sniffer$2.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE);
5232
5327
  }
5233
- const Codec$3 = window["VePlayer"].Codec;
5234
- const strategy$1 = window["VePlayer"].strategy;
5235
- const load$6 = window["VePlayer"].load;
5236
- const Sniffer$2 = window["VePlayer"].Sniffer;
5237
- const util$3 = window["VePlayer"].util;
5238
- const { isMseSupported: isMseSupported$1 } = util$3;
5239
5328
  function enableHlsJs(options) {
5240
- var _a, _b;
5241
- if ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableHlsJs) {
5329
+ var _a, _b, _c;
5330
+ if (typeof ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableHlsJs) !== "undefined") {
5331
+ return (_b = options.hls) == null ? void 0 : _b.enableHlsJs;
5332
+ }
5333
+ if (((_c = options == null ? void 0 : options.ad) == null ? void 0 : _c.adType) === "ssai") {
5242
5334
  return true;
5243
5335
  }
5244
- if (((_b = options == null ? void 0 : options.ad) == null ? void 0 : _b.adType) === "ssai") {
5336
+ if (options.drm) {
5245
5337
  return true;
5246
5338
  }
5247
5339
  return false;
5248
5340
  }
5341
+ function transformHlsDrmConfig(drmConfig) {
5342
+ const drmSystems = {};
5343
+ for (const key in drmConfig) {
5344
+ if (drmConfig.hasOwnProperty(key)) {
5345
+ const drmSystemKey = KeyNameMap[key];
5346
+ const drmSystemUrls = drmConfig[key];
5347
+ if (drmSystemKey && drmSystemUrls) {
5348
+ drmSystems[drmSystemKey] = {
5349
+ licenseUrl: drmSystemUrls == null ? void 0 : drmSystemUrls.serverProcessSPCPath,
5350
+ serverCertificateUrl: drmSystemUrls == null ? void 0 : drmSystemUrls.serverCertificatePath
5351
+ };
5352
+ }
5353
+ }
5354
+ }
5355
+ return {
5356
+ emeEnabled: true,
5357
+ drmSystems
5358
+ };
5359
+ }
5360
+ const Codec$4 = window["VePlayer"].Codec;
5361
+ const strategy$1 = window["VePlayer"].strategy;
5362
+ const load$6 = window["VePlayer"].load;
5363
+ const util$3 = window["VePlayer"].util;
5364
+ const { isMseSupported: isMseSupported$1 } = util$3;
5249
5365
  const getHlsStrategy = async (options) => {
5250
- var _a, _b;
5366
+ var _a;
5251
5367
  let mseStrategy;
5252
5368
  let softStrategy;
5253
- if (!isMseSupportedWithDrm({ drm: options.drm, streamType: "hls" })) {
5254
- return { options: {}, plugins: [] };
5255
- }
5256
5369
  const codec = await strategy$1.getCodec(options);
5257
5370
  const isSoftDecode = await strategy$1.isSoftDecode(options, codec);
5258
5371
  const useHlsJs = enableHlsJs(options);
5259
5372
  if (isSoftDecode) {
5260
- softStrategy = codec === Codec$3.H265 ? strategy$1.createSoftDecodeH265Strategy() : strategy$1.createSoftDecodeH264Strategy();
5373
+ softStrategy = codec === Codec$4.H265 ? strategy$1.createSoftDecodeH265Strategy() : strategy$1.createSoftDecodeH264Strategy();
5261
5374
  mseStrategy = strategy$1.createHlsMseStrategy(options, useHlsJs);
5262
5375
  }
5263
- if ((Sniffer$2.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE)) && (codec === "unknown" ? isMseSupported$1(Codec$3.H264) : isMseSupported$1(codec))) {
5376
+ if (enableMse(options) && (codec === "unknown" ? isMseSupported$1(Codec$4.H264) : isMseSupported$1(codec))) {
5264
5377
  mseStrategy = strategy$1.createHlsMseStrategy(options, useHlsJs);
5265
5378
  }
5266
5379
  if (!mseStrategy && !softStrategy) {
@@ -5270,7 +5383,7 @@ const getHlsStrategy = async (options) => {
5270
5383
  (mseStrategy == null ? void 0 : mseStrategy.module) && load$6(mseStrategy.module).catch(() => void 0),
5271
5384
  (softStrategy == null ? void 0 : softStrategy.module) && load$6(softStrategy.module).catch(() => void 0)
5272
5385
  ]);
5273
- (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));
5386
+ (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));
5274
5387
  const combineOptions = strategy$1.combineOptions([mseStrategy, softStrategy]);
5275
5388
  return {
5276
5389
  options: combineOptions,
@@ -5343,39 +5456,6 @@ function modifyPlaylistUrl(playlist, callback) {
5343
5456
  }
5344
5457
  const DynamicModule$5 = window["VePlayer"].DynamicModule;
5345
5458
  const load$5 = window["VePlayer"].load;
5346
- const getDrmStrategy = async (options, player) => {
5347
- var _a;
5348
- const drmType = getDrmType(options.drm);
5349
- if (options.url && drmType === DrmType.Fairplay) {
5350
- try {
5351
- const { getDrmConfig, ...originFairplayConfig } = ((_a = options == null ? void 0 : options.drm) == null ? void 0 : _a.fairplay) ?? {};
5352
- const [drmPlugin, drmConfig] = await Promise.all([
5353
- load$5(DynamicModule$5.PluginDrm).then((module) => module.DrmPlugin).catch(() => void 0),
5354
- getDrmConfig == null ? void 0 : getDrmConfig({
5355
- url: options.url
5356
- })
5357
- ]);
5358
- const fairplayDrmConfig = Object.assign(
5359
- {},
5360
- originFairplayConfig,
5361
- options == null ? void 0 : options.drm,
5362
- drmConfig
5363
- );
5364
- drmConfig && (player == null ? void 0 : player.updateDrmConfig(drmConfig));
5365
- return {
5366
- options: {
5367
- drm: fairplayDrmConfig
5368
- },
5369
- plugins: drmPlugin ? [drmPlugin] : []
5370
- };
5371
- } catch (error2) {
5372
- console.log(error2);
5373
- }
5374
- }
5375
- return {};
5376
- };
5377
- const DynamicModule$4 = window["VePlayer"].DynamicModule;
5378
- const load$4 = window["VePlayer"].load;
5379
5459
  const util$2 = window["VePlayer"].util;
5380
5460
  class HlsProtocol extends BaseProtocol {
5381
5461
  static get suffix() {
@@ -5420,7 +5500,7 @@ class HlsProtocol extends BaseProtocol {
5420
5500
  if (!abrOptions) {
5421
5501
  return {};
5422
5502
  }
5423
- const abrPlugin = await load$4(DynamicModule$4.PluginAbr).catch(
5503
+ const abrPlugin = await load$5(DynamicModule$5.PluginAbr).catch(
5424
5504
  () => void 0
5425
5505
  );
5426
5506
  return {
@@ -5433,14 +5513,58 @@ class HlsProtocol extends BaseProtocol {
5433
5513
  plugins: [abrPlugin == null ? void 0 : abrPlugin.HlsAbrPlugin]
5434
5514
  };
5435
5515
  }
5436
- getDrmStrategy(options, { player }) {
5437
- return getDrmStrategy(options, player);
5516
+ async updateDrmConfig(drmConfig, player) {
5517
+ var _a, _b, _c, _d;
5518
+ if (!drmConfig) {
5519
+ return;
5520
+ }
5521
+ const drmPlugin = (_b = (_a = player == null ? void 0 : player._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm;
5522
+ const hlsPlugin = (_d = (_c = player == null ? void 0 : player._player) == null ? void 0 : _c.plugins) == null ? void 0 : _d.hls;
5523
+ if (drmPlugin) {
5524
+ drmPlugin.restart();
5525
+ return drmPlugin.updateConfig(drmConfig);
5526
+ } else if (hlsPlugin) {
5527
+ hlsPlugin.config = {
5528
+ ...hlsPlugin.config,
5529
+ ...transformHlsDrmConfig(drmConfig)
5530
+ };
5531
+ }
5532
+ }
5533
+ async getDrmStrategy(options, { player }) {
5534
+ try {
5535
+ if (!(options == null ? void 0 : options.drm)) {
5536
+ return { options: {}, plugins: [] };
5537
+ }
5538
+ const drmConfig = (options == null ? void 0 : options.drm) ?? {};
5539
+ if (!preferNativeForFairplay(options) && enableHlsJs(options)) {
5540
+ return {
5541
+ options: {
5542
+ hls: {
5543
+ ...options.hls,
5544
+ ...transformHlsDrmConfig(drmConfig)
5545
+ }
5546
+ },
5547
+ plugins: []
5548
+ };
5549
+ }
5550
+ const drmPlugin = await load$5(DynamicModule$5.PluginDrm).then((module) => module.DrmPlugin).catch(() => void 0);
5551
+ drmConfig && await (player == null ? void 0 : player.updateDrmConfig(drmConfig));
5552
+ return {
5553
+ options: {
5554
+ drm: drmConfig
5555
+ },
5556
+ plugins: drmPlugin ? [drmPlugin] : []
5557
+ };
5558
+ } catch (error2) {
5559
+ console.log(error2);
5560
+ }
5561
+ return {};
5438
5562
  }
5439
5563
  getVeStrategy() {
5440
5564
  return void 0;
5441
5565
  }
5442
5566
  }
5443
- class HlsLowLatencyProtocol extends BaseProtocol {
5567
+ class HlsLowLatencyProtocol extends HlsProtocol {
5444
5568
  static get suffix() {
5445
5569
  return ".m3u8";
5446
5570
  }
@@ -5465,37 +5589,31 @@ class HlsLowLatencyProtocol extends BaseProtocol {
5465
5589
  async getProtocolStrategy(options) {
5466
5590
  return getHlsStrategy(options);
5467
5591
  }
5468
- getAbrStrategy() {
5469
- return void 0;
5470
- }
5471
- getDrmStrategy() {
5472
- return void 0;
5473
- }
5474
5592
  getVeStrategy() {
5475
5593
  return void 0;
5476
5594
  }
5477
5595
  }
5478
- const DynamicModule$3 = window["VePlayer"].DynamicModule;
5479
- const load$3 = window["VePlayer"].load;
5596
+ const DynamicModule$4 = window["VePlayer"].DynamicModule;
5597
+ const load$4 = window["VePlayer"].load;
5480
5598
  async function isRTMSupported() {
5481
- const { RtmPlugin } = await load$3(DynamicModule$3.PluginRtm);
5599
+ const { RtmPlugin } = await load$4(DynamicModule$4.PluginRtm);
5482
5600
  return RtmPlugin.isSupported();
5483
5601
  }
5484
5602
  async function isRTMSupportCodec(codec = RTMCodec.H264) {
5485
- const { RtmPlugin } = await load$3(DynamicModule$3.PluginRtm);
5603
+ const { RtmPlugin } = await load$4(DynamicModule$4.PluginRtm);
5486
5604
  if (codec === RTMCodec.H264)
5487
5605
  return RtmPlugin.isSupportedH264();
5488
5606
  return false;
5489
5607
  }
5490
5608
  const strategy = window["VePlayer"].strategy;
5491
5609
  const util$1 = window["VePlayer"].util;
5492
- const DynamicModule$2 = window["VePlayer"].DynamicModule;
5493
- const load$2 = window["VePlayer"].load;
5494
- const Codec$2 = window["VePlayer"].Codec;
5610
+ const DynamicModule$3 = window["VePlayer"].DynamicModule;
5611
+ const load$3 = window["VePlayer"].load;
5612
+ const Codec$3 = window["VePlayer"].Codec;
5495
5613
  const Sniffer$1 = window["VePlayer"].Sniffer;
5496
5614
  const rtmStrategy = {
5497
5615
  options: {},
5498
- module: DynamicModule$2.PluginRtm
5616
+ module: DynamicModule$3.PluginRtm
5499
5617
  };
5500
5618
  const generateFallbackUrl = (url2) => {
5501
5619
  if (Sniffer$1.device === "pc") {
@@ -5527,19 +5645,19 @@ const getRtmStrategy = async (options, player, i18n) => {
5527
5645
  }
5528
5646
  }
5529
5647
  const backupType = actualFallbackUrl && util$1.getStreamType(actualFallbackUrl);
5530
- if (backupType === "flv" && util$1.isMseSupported(Codec$2.H264)) {
5648
+ if (backupType === "flv" && util$1.isMseSupported(Codec$3.H264)) {
5531
5649
  backupStrategy = strategy.createFlvMseStrategy(options);
5532
- } else if (backupType === "hls" && (Sniffer$1.device !== "mobile" || ((_b = options == null ? void 0 : options.hls) == null ? void 0 : _b.enableMSE)) && util$1.isMseSupported(Codec$2.H264)) {
5650
+ } else if (backupType === "hls" && (Sniffer$1.device !== "mobile" || ((_b = options == null ? void 0 : options.hls) == null ? void 0 : _b.enableMSE)) && util$1.isMseSupported(Codec$3.H264)) {
5533
5651
  backupStrategy = strategy.createHlsMseStrategy(options);
5534
5652
  }
5535
5653
  const [rtmCdn, backupCdn] = await Promise.all([
5536
- load$2(rtmStrategy.module).then((module) => {
5654
+ load$3(rtmStrategy.module).then((module) => {
5537
5655
  return module.RtmPlugin;
5538
5656
  }).catch(() => void 0),
5539
- backupStrategy && load$2(backupStrategy.module).then((module) => {
5540
- if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$2.PluginFlv) {
5657
+ backupStrategy && load$3(backupStrategy.module).then((module) => {
5658
+ if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$3.PluginFlv) {
5541
5659
  return module.FlvPlugin;
5542
- } else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$2.PluginHls) {
5660
+ } else if ((backupStrategy == null ? void 0 : backupStrategy.module) === DynamicModule$3.PluginHls) {
5543
5661
  return module.HlsPlugin;
5544
5662
  }
5545
5663
  }).catch(() => void 0)
@@ -5668,6 +5786,9 @@ class RtmProtocol extends BaseProtocol {
5668
5786
  plugins: []
5669
5787
  };
5670
5788
  }
5789
+ updateDrmConfig() {
5790
+ return void 0;
5791
+ }
5671
5792
  }
5672
5793
  class ProtocolSelector {
5673
5794
  constructor({ queue, streams, options }) {
@@ -6437,6 +6558,100 @@ lodash_merge.exports;
6437
6558
  })(lodash_merge, lodash_merge.exports);
6438
6559
  var lodash_mergeExports = lodash_merge.exports;
6439
6560
  var merge = /* @__PURE__ */ getDefaultExportFromCjs$1(lodash_mergeExports);
6561
+ const DynamicModule$2 = window["VePlayer"].DynamicModule;
6562
+ const createDashMseStrategy = () => ({
6563
+ options: {},
6564
+ module: DynamicModule$2.PluginDashJs
6565
+ });
6566
+ const Codec$2 = window["VePlayer"].Codec;
6567
+ function isDASHSupported(codec = Codec$2.H264) {
6568
+ return isMMSSupported$2(codec) || isMseSupported$3(codec);
6569
+ }
6570
+ const load$2 = window["VePlayer"].load;
6571
+ class DashProtocol extends BaseProtocol {
6572
+ static get suffix() {
6573
+ return ".mpd";
6574
+ }
6575
+ get protocolType() {
6576
+ return LiveUrlType.Dash;
6577
+ }
6578
+ get defaultFallbackStrategy() {
6579
+ return {};
6580
+ }
6581
+ static canGenerateOtherProtocol() {
6582
+ return true;
6583
+ }
6584
+ static generateUrl(urls, {
6585
+ generateUrlFromOtherProtocol: generateUrlFromOtherProtocol2
6586
+ }) {
6587
+ return urls[LiveUrlType.Dash] ?? generateUrlFromOtherProtocol2();
6588
+ }
6589
+ async canPlay() {
6590
+ return {
6591
+ canPlay: isDASHSupported()
6592
+ };
6593
+ }
6594
+ shouldFallbackWhenStall() {
6595
+ return false;
6596
+ }
6597
+ async getProtocolStrategy(options) {
6598
+ const mseStrategy = createDashMseStrategy();
6599
+ if (!mseStrategy) {
6600
+ return {};
6601
+ }
6602
+ const mseModule = await ((mseStrategy == null ? void 0 : mseStrategy.module) && load$2(mseStrategy.module).catch(() => void 0));
6603
+ return {
6604
+ options: mseStrategy.options,
6605
+ plugins: (mseModule == null ? void 0 : mseModule.DashPlugin) ? [mseModule.DashPlugin] : []
6606
+ };
6607
+ }
6608
+ getAbrStrategy() {
6609
+ return void 0;
6610
+ }
6611
+ getVeStrategy() {
6612
+ return void 0;
6613
+ }
6614
+ async getDrmStrategy(options) {
6615
+ if (!(options == null ? void 0 : options.drm)) {
6616
+ return {};
6617
+ }
6618
+ const dashDrm = this._generateDashDrmConfig(options.drm);
6619
+ return {
6620
+ options: {
6621
+ dash: {
6622
+ ...options.dash,
6623
+ protData: dashDrm
6624
+ }
6625
+ },
6626
+ plugins: []
6627
+ };
6628
+ }
6629
+ updateDrmConfig(drm, player) {
6630
+ var _a, _b;
6631
+ if (!drm) {
6632
+ return;
6633
+ }
6634
+ const dashDrm = this._generateDashDrmConfig(drm);
6635
+ const dashPlugin = (_b = (_a = player == null ? void 0 : player._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.dash;
6636
+ if (dashPlugin) {
6637
+ dashPlugin.protData = dashDrm;
6638
+ }
6639
+ }
6640
+ _generateDashDrmConfig(drm) {
6641
+ return Object.keys(drm).reduce((pre, cur) => {
6642
+ var _a;
6643
+ const keyName = KeyNameMap[cur];
6644
+ if (keyName) {
6645
+ pre[keyName] = {
6646
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
6647
+ // @ts-ignore
6648
+ serverURL: (_a = drm == null ? void 0 : drm[cur]) == null ? void 0 : _a.serverProcessSPCPath
6649
+ };
6650
+ }
6651
+ return pre;
6652
+ }, {});
6653
+ }
6654
+ }
6440
6655
  const _ProtocolManager = class {
6441
6656
  constructor(options) {
6442
6657
  __publicField(this, "_options");
@@ -6591,7 +6806,8 @@ __publicField(ProtocolManager, "_protocolMap", {
6591
6806
  [LiveUrlType.LLFlv]: FlvLowLatencyProtocol,
6592
6807
  [LiveUrlType.Hls]: HlsProtocol,
6593
6808
  [LiveUrlType.LLHls]: HlsLowLatencyProtocol,
6594
- [LiveUrlType.Rtm]: RtmProtocol
6809
+ [LiveUrlType.Rtm]: RtmProtocol,
6810
+ [LiveUrlType.Dash]: DashProtocol
6595
6811
  });
6596
6812
  class Fallback {
6597
6813
  constructor() {
@@ -24334,9 +24550,9 @@ class VePlayerLive extends VePlayerBase {
24334
24550
  * @brief Use this method to update DRM configuration.
24335
24551
  * @param config A configuration object containing settings for Fairplay DRM.
24336
24552
  */
24337
- updateDrmConfig(config2) {
24338
- var _a, _b, _c;
24339
- (_c = (_b = (_a = this._player) == null ? void 0 : _a.plugins) == null ? void 0 : _b.drm) == null ? void 0 : _c.updateDrmConfig(config2);
24553
+ async updateDrmConfig(config2) {
24554
+ var _a, _b;
24555
+ return (_b = (_a = this._protocolManager) == null ? void 0 : _a.protocol) == null ? void 0 : _b.updateDrmConfig(config2, this);
24340
24556
  }
24341
24557
  /** {zh}
24342
24558
  * @brief 修改 ABR 配置,包含修改是否开启 ABR 功能,和修改其他清晰度。
@@ -24555,6 +24771,7 @@ export {
24555
24771
  Codec,
24556
24772
  DecodeType,
24557
24773
  Degradation,
24774
+ DrmType,
24558
24775
  DynamicModule,
24559
24776
  EN,
24560
24777
  ListType,