@volcengine/veplayer 2.5.0 → 2.6.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/esm/index.d.ts CHANGED
@@ -3994,7 +3994,6 @@ declare namespace strategy {
3994
3994
  }
3995
3995
  type StrategyCreator<T, R extends keyof ModulesMap = any> = (options?: T) => Strategy<T, R>;
3996
3996
  const createFlvMseStrategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginFlv>;
3997
- const createFlvMssStrategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginFlv>;
3998
3997
  const createHlsMseStrategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginHls>;
3999
3998
  const createSoftDecodeH264Strategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginXgvideo>;
4000
3999
  const createSoftDecodeH265Strategy: StrategyCreator<VePlayerBaseOptions, DynamicModule.PluginXgvideo>;
@@ -44,7 +44,7 @@ const strategy$1 = window["VePlayer"].strategy;
44
44
  const util$4 = window["VePlayer"].util;
45
45
  const DynamicModule$3 = window["VePlayer"].DynamicModule;
46
46
  const load$3 = window["VePlayer"].load;
47
- const Codec$2 = window["VePlayer"].Codec;
47
+ const Codec$1 = window["VePlayer"].Codec;
48
48
  const Sniffer$3 = window["VePlayer"].Sniffer;
49
49
  const rtmStrategy = {
50
50
  options: {},
@@ -69,9 +69,9 @@ const getRtmStrategy = async (options, player) => {
69
69
  } = options.rtm || {};
70
70
  const actualFallbackUrl = !enableFallback ? "" : !fallbackUrl && url ? generateFallbackUrl(url) : fallbackUrl;
71
71
  const backupType = actualFallbackUrl && util$4.getStreamType(actualFallbackUrl);
72
- if (backupType === "flv" && util$4.isMseSupported(Codec$2.H264)) {
72
+ if (backupType === "flv" && util$4.isMseSupported(Codec$1.H264)) {
73
73
  backupStrategy = strategy$1.createFlvMseStrategy(options);
74
- } else if (backupType === "hls" && (Sniffer$3.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE)) && util$4.isMseSupported(Codec$2.H264)) {
74
+ } else if (backupType === "hls" && (Sniffer$3.device !== "mobile" || ((_a = options == null ? void 0 : options.hls) == null ? void 0 : _a.enableMSE)) && util$4.isMseSupported(Codec$1.H264)) {
75
75
  backupStrategy = strategy$1.createHlsMseStrategy(options);
76
76
  }
77
77
  const [rtmCdn, backupCdn] = await Promise.all([
@@ -542,9 +542,9 @@ function getBrowser() {
542
542
  }
543
543
  return browserInfo;
544
544
  }
545
- var sniffer$1 = {
545
+ var sniffer = {
546
546
  get device() {
547
- var r2 = sniffer$1.os;
547
+ var r2 = sniffer.os;
548
548
  return r2.isPc ? "pc" : "mobile";
549
549
  },
550
550
  get browser() {
@@ -900,7 +900,7 @@ function getCommonLog(options) {
900
900
  codec_type: options.codec_type || "h264",
901
901
  width: Math.floor(player.config.width),
902
902
  height: Math.floor(player.config.height),
903
- browser: sniffer$1.browser,
903
+ browser: sniffer.browser,
904
904
  ua: navigator.userAgent,
905
905
  href: window.location.href,
906
906
  timestamp: 0,
@@ -1042,7 +1042,7 @@ var navigatorConnectionType = function navigatorConnectionType2() {
1042
1042
  var getNetStat = function getNetStat2() {
1043
1043
  if (navgatorOnlineSupported()) {
1044
1044
  if (navigator.onLine) {
1045
- return navigatorConnectionType() || sniffer$1.device;
1045
+ return navigatorConnectionType() || sniffer.device;
1046
1046
  } else {
1047
1047
  return "none";
1048
1048
  }
@@ -1056,7 +1056,7 @@ var LoggerControl = /* @__PURE__ */ function() {
1056
1056
  this.logger = new XgLiveLogger(options);
1057
1057
  this.restart = this.restart.bind(this);
1058
1058
  this.bindUrlChange();
1059
- sniffer$1.browser.includes("Chrome");
1059
+ sniffer.browser.includes("Chrome");
1060
1060
  }
1061
1061
  var _proto = LoggerControl2.prototype;
1062
1062
  _proto.restart = function restart(report_stop) {
@@ -1178,7 +1178,7 @@ var XgLiveLogger = /* @__PURE__ */ function() {
1178
1178
  var player = options.player;
1179
1179
  var isHLS = player.hlsOps !== void 0;
1180
1180
  this.commonParams = _objectSpread2({
1181
- os: sniffer$1.operation_os
1181
+ os: sniffer.operation_os
1182
1182
  }, getCommonLog(options));
1183
1183
  this.log = Object.assign({}, getDefaultLog());
1184
1184
  var self2 = this;
@@ -1250,17 +1250,17 @@ var XgLiveLogger = /* @__PURE__ */ function() {
1250
1250
  }
1251
1251
  };
1252
1252
  _proto2.initWindowListener = function initWindowListener() {
1253
- if (sniffer$1.device === "pc") {
1253
+ if (sniffer.device === "pc") {
1254
1254
  window.addEventListener("beforeunload", this.handleUserLeave);
1255
- } else if (sniffer$1.device === "mobile") {
1255
+ } else if (sniffer.device === "mobile") {
1256
1256
  window.addEventListener("beforeunload", this.handleUserLeave);
1257
1257
  window.addEventListener("pagehide", this.handleUserLeave);
1258
1258
  }
1259
1259
  };
1260
1260
  _proto2.removeWindowListener = function removeWindowListener() {
1261
- if (sniffer$1.device === "pc") {
1261
+ if (sniffer.device === "pc") {
1262
1262
  window.removeEventListener("beforeunload", this.handleUserLeave);
1263
- } else if (sniffer$1.device === "mobile") {
1263
+ } else if (sniffer.device === "mobile") {
1264
1264
  window.removeEventListener("beforeunload", this.handleUserLeave);
1265
1265
  window.removeEventListener("pagehide", this.handleUserLeave);
1266
1266
  }
@@ -1944,9 +1944,9 @@ var XgLiveLogger = /* @__PURE__ */ function() {
1944
1944
  this.handleUserLeave();
1945
1945
  }
1946
1946
  this.destroyed = true;
1947
- if (sniffer$1.device === "pc") {
1947
+ if (sniffer.device === "pc") {
1948
1948
  window.removeEventListener("beforeunload", this.handleUserLeave);
1949
- } else if (sniffer$1.device === "mobile") {
1949
+ } else if (sniffer.device === "mobile") {
1950
1950
  window.removeEventListener("pagehide", this.handleUserLeave);
1951
1951
  }
1952
1952
  videoEvts.forEach(function(name) {
@@ -2990,10 +2990,10 @@ class Logger extends Plugin$2 {
2990
2990
  user_id: this._userId,
2991
2991
  device_id: this._deviceId,
2992
2992
  ext: {
2993
- veplayer_version: "2.3.0",
2994
- flv_version: "3.0.21-rc.2",
2995
- hls_version: "3.0.21-rc.2",
2996
- rts_version: "0.2.1-alpha.12"
2993
+ veplayer_version: "2.3.1-rc.1",
2994
+ flv_version: "3.0.21-rc.3",
2995
+ hls_version: "3.0.21-rc.3",
2996
+ rts_version: "0.2.1-alpha.0"
2997
2997
  }
2998
2998
  });
2999
2999
  }
@@ -3294,160 +3294,6 @@ const getDrmStrategy = async (options, player) => {
3294
3294
  }
3295
3295
  return {};
3296
3296
  };
3297
- var VERSION_REG = {
3298
- android: /(Android)\s([\d.]+)/,
3299
- ios: /(Version)\/([\d.]+)/
3300
- };
3301
- var H264_MIMETYPES = ["avc1.42E01E, mp4a.40.2", "avc1.58A01E, mp4a.40.2", "avc1.4D401E, mp4a.40.2", "avc1.64001E, mp4a.40.2", "avc1.42E01E", "mp4v.20.8", "mp4v.20.8, mp4a.40.2", "mp4v.20.240, mp4a.40.2"];
3302
- var sniffer = {
3303
- get device() {
3304
- var r2 = sniffer.os;
3305
- return r2.isPc ? "pc" : "mobile";
3306
- },
3307
- get browser() {
3308
- if (typeof navigator === "undefined") {
3309
- return "";
3310
- }
3311
- var ua = navigator.userAgent.toLowerCase();
3312
- var reg = {
3313
- ie: /rv:([\d.]+)\) like gecko/,
3314
- firefox: /firefox\/([\d.]+)/,
3315
- chrome: /chrome\/([\d.]+)/,
3316
- opera: /opera.([\d.]+)/,
3317
- safari: /version\/([\d.]+).*safari/
3318
- };
3319
- return [].concat(Object.keys(reg).filter(function(key) {
3320
- return reg[key].test(ua);
3321
- }))[0];
3322
- },
3323
- get os() {
3324
- if (typeof navigator === "undefined") {
3325
- return {};
3326
- }
3327
- var ua = navigator.userAgent;
3328
- var isWindowsPhone = /(?:Windows Phone)/.test(ua);
3329
- var isSymbian = /(?:SymbianOS)/.test(ua) || isWindowsPhone;
3330
- var isAndroid = /(?:Android)/.test(ua);
3331
- var isFireFox = /(?:Firefox)/.test(ua);
3332
- var isIpad = /(?:iPad|PlayBook)/.test(ua) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
3333
- var isTablet = isIpad || isAndroid && !/(?:Mobile)/.test(ua) || isFireFox && /(?:Tablet)/.test(ua);
3334
- var isPhone = /(?:iPhone)/.test(ua) && !isTablet;
3335
- var isPc = !isPhone && !isAndroid && !isSymbian && !isTablet;
3336
- return {
3337
- isTablet,
3338
- isPhone,
3339
- isIpad,
3340
- isIos: isPhone || isIpad,
3341
- isAndroid,
3342
- isPc,
3343
- isSymbian,
3344
- isWindowsPhone,
3345
- isFireFox
3346
- };
3347
- },
3348
- get osVersion() {
3349
- if (typeof navigator === "undefined") {
3350
- return 0;
3351
- }
3352
- var ua = navigator.userAgent;
3353
- var reg = "";
3354
- if (/(?:iPhone)|(?:iPad|PlayBook)/.test(ua)) {
3355
- reg = VERSION_REG.ios;
3356
- } else {
3357
- reg = VERSION_REG.android;
3358
- }
3359
- var _match = reg ? reg.exec(ua) : [];
3360
- if (_match && _match.length >= 3) {
3361
- var version = _match[2].split(".");
3362
- return version.length > 0 ? parseInt(version[0]) : 0;
3363
- }
3364
- return 0;
3365
- },
3366
- get isWeixin() {
3367
- if (typeof navigator === "undefined") {
3368
- return false;
3369
- }
3370
- var reg = /(micromessenger)\/([\d.]+)/;
3371
- var match = reg.exec(navigator.userAgent.toLocaleLowerCase());
3372
- if (match) {
3373
- return true;
3374
- }
3375
- return false;
3376
- },
3377
- isSupportMP4: function isSupportMP4() {
3378
- var result = {
3379
- isSupport: false,
3380
- mime: ""
3381
- };
3382
- if (typeof document === "undefined") {
3383
- return result;
3384
- }
3385
- if (this.supportResult) {
3386
- return this.supportResult;
3387
- }
3388
- var a2 = document.createElement("video");
3389
- if (typeof a2.canPlayType === "function") {
3390
- H264_MIMETYPES.map(function(key) {
3391
- if (a2.canPlayType('video/mp4; codecs="'.concat(key, '"')) === "probably") {
3392
- result.isSupport = true;
3393
- result.mime += "||".concat(key);
3394
- }
3395
- });
3396
- }
3397
- this.supportResult = result;
3398
- a2 = null;
3399
- return result;
3400
- },
3401
- isMSESupport: function isMSESupport() {
3402
- var mime = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';
3403
- if (typeof MediaSource === "undefined" || !MediaSource)
3404
- return false;
3405
- try {
3406
- return MediaSource.isTypeSupported(mime);
3407
- } catch (error2) {
3408
- this._logger.error(mime, error2);
3409
- return false;
3410
- }
3411
- },
3412
- isHevcSupported: function isHevcSupported() {
3413
- if (typeof MediaSource === "undefined" || !MediaSource.isTypeSupported) {
3414
- return false;
3415
- }
3416
- return MediaSource.isTypeSupported('video/mp4;codecs="hev1.1.6.L120.90"') || MediaSource.isTypeSupported('video/mp4;codecs="hev1.2.4.L120.90"') || MediaSource.isTypeSupported('video/mp4;codecs="hev1.3.E.L120.90"') || MediaSource.isTypeSupported('video/mp4;codecs="hev1.4.10.L120.90"');
3417
- },
3418
- probeConfigSupported: function probeConfigSupported(info) {
3419
- var defaults = {
3420
- supported: false,
3421
- smooth: false,
3422
- powerEfficient: false
3423
- };
3424
- if (!info || typeof navigator === "undefined") {
3425
- return Promise.resolve(defaults);
3426
- }
3427
- if (navigator.mediaCapabilities && navigator.mediaCapabilities.decodingInfo) {
3428
- return navigator.mediaCapabilities.decodingInfo(info);
3429
- } else {
3430
- var videoConfig = info.video || {};
3431
- var audioConfig = info.audio || {};
3432
- try {
3433
- var videoSupported = MediaSource.isTypeSupported(videoConfig.contentType);
3434
- var audioSupported = MediaSource.isTypeSupported(audioConfig.contentType);
3435
- return Promise.resolve({
3436
- supported: videoSupported && audioSupported,
3437
- smooth: false,
3438
- powerEfficient: false
3439
- });
3440
- } catch (e3) {
3441
- return Promise.resolve(defaults);
3442
- }
3443
- }
3444
- }
3445
- };
3446
- var Codec$1 = /* @__PURE__ */ ((Codec2) => {
3447
- Codec2["H265"] = "h265";
3448
- Codec2["H264"] = "h264";
3449
- return Codec2;
3450
- })(Codec$1 || {});
3451
3297
  function isType(suffix) {
3452
3298
  return function(url) {
3453
3299
  return url == null ? void 0 : url.split("?")[0].toLowerCase().includes(suffix);
@@ -3476,15 +3322,6 @@ function getStreamType(url) {
3476
3322
  }
3477
3323
  return "unknown";
3478
3324
  }
3479
- function isMseSupported$1(codec = Codec$1.H264) {
3480
- if (codec === Codec$1.H265) {
3481
- return sniffer.isHevcSupported();
3482
- }
3483
- return sniffer.isMSESupport();
3484
- }
3485
- function isMMSSupported$1() {
3486
- return typeof ManagedMediaSource !== "undefined";
3487
- }
3488
3325
  const DynamicModule$1 = window["VePlayer"].DynamicModule;
3489
3326
  const load$1 = window["VePlayer"].load;
3490
3327
  const getAbrStrategy = async (options) => {
@@ -3789,9 +3626,6 @@ async function createLivePlayer(options) {
3789
3626
  }
3790
3627
  return player;
3791
3628
  }
3792
- function isFLVSupported() {
3793
- return isMseSupported$1() || isMMSSupported$1();
3794
- }
3795
3629
  var live = /* @__PURE__ */ Object.freeze({
3796
3630
  __proto__: null,
3797
3631
  ErrorCode,
@@ -3815,7 +3649,6 @@ const ListType = window["VePlayer"].ListType;
3815
3649
  setModuleSystem("esm");
3816
3650
  const isMseSupported = util.isMseSupported;
3817
3651
  const isSoftDecodeSupported = util.isSoftDecodeSupported;
3818
- const isMMSSupported = util.isMMSSupported;
3819
3652
  export {
3820
3653
  Codec,
3821
3654
  DecodeType,
@@ -3829,8 +3662,6 @@ export {
3829
3662
  Sniffer,
3830
3663
  ZH_CN,
3831
3664
  createLivePlayer,
3832
- isFLVSupported,
3833
- isMMSSupported,
3834
3665
  isMseSupported,
3835
3666
  isRTMSupportCodec,
3836
3667
  isRTMSupported,