@byteplus/veplayer-plugin 2.3.0 → 2.3.1-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/esm/index.development.js +86 -34
  2. package/esm/index.production.js +1 -1
  3. package/esm/veplayer.plugin.flv.development.js +82 -30
  4. package/esm/veplayer.plugin.flv.production.js +1 -1
  5. package/package.json +1 -1
  6. package/umd/veplayer.plugin.flv.development.js +82 -30
  7. package/umd/veplayer.plugin.flv.production.js +1 -1
  8. package/esm/veplayer.plugin.drm.development.js +0 -1577
  9. package/esm/veplayer.plugin.drm.production.js +0 -2
  10. package/esm/veplayer.plugin.mp4.development.js +0 -38039
  11. package/esm/veplayer.plugin.mp4.production.js +0 -2
  12. package/esm/veplayer.plugin.rtm.development.js +0 -5587
  13. package/esm/veplayer.plugin.rtm.production.js +0 -2
  14. package/esm/veplayer.plugin.shaka.development.js +0 -15973
  15. package/esm/veplayer.plugin.shaka.production.js +0 -20
  16. package/esm/veplayer.plugin.time.shift.development.css +0 -63
  17. package/esm/veplayer.plugin.time.shift.development.js +0 -339
  18. package/esm/veplayer.plugin.time.shift.production.css +0 -1
  19. package/esm/veplayer.plugin.time.shift.production.js +0 -2
  20. package/esm/veplayer.plugin.xgvideo.development.js +0 -19097
  21. package/esm/veplayer.plugin.xgvideo.production.js +0 -2
  22. package/umd/veplayer.plugin.drm.development.js +0 -1579
  23. package/umd/veplayer.plugin.drm.production.js +0 -1
  24. package/umd/veplayer.plugin.mp4.development.js +0 -38043
  25. package/umd/veplayer.plugin.mp4.production.js +0 -1
  26. package/umd/veplayer.plugin.rtm.development.js +0 -5589
  27. package/umd/veplayer.plugin.rtm.production.js +0 -1
  28. package/umd/veplayer.plugin.shaka.development.js +0 -15977
  29. package/umd/veplayer.plugin.shaka.production.js +0 -1
  30. package/umd/veplayer.plugin.time.shift.development.css +0 -63
  31. package/umd/veplayer.plugin.time.shift.development.js +0 -342
  32. package/umd/veplayer.plugin.time.shift.production.css +0 -1
  33. package/umd/veplayer.plugin.time.shift.production.js +0 -1
  34. package/umd/veplayer.plugin.xgvideo.development.js +0 -19099
  35. package/umd/veplayer.plugin.xgvideo.production.js +0 -1
@@ -3249,12 +3249,19 @@ function logable$2(obj, maxDepth, depth) {
3249
3249
  return result;
3250
3250
  }
3251
3251
  function getMediaSource$2() {
3252
+ var preferMMS = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
3252
3253
  try {
3253
- return isBrowser$5 ? window.MediaSource : null;
3254
+ if (!isBrowser$5)
3255
+ return null;
3256
+ if (preferMMS && typeof ManagedMediaSource !== "undefined")
3257
+ return ManagedMediaSource;
3258
+ return window.MediaSource;
3254
3259
  } catch (e) {
3255
3260
  }
3256
3261
  }
3257
- var MediaSource$3 = getMediaSource$2();
3262
+ function isMMS(mediaSource) {
3263
+ return /ManagedMediaSource/gi.test(Object.prototype.toString.call(mediaSource));
3264
+ }
3258
3265
  var OP_NAME$3 = {
3259
3266
  APPEND: "appendBuffer",
3260
3267
  REMOVE: "removeBuffer",
@@ -3275,6 +3282,12 @@ var MSE$3 = /* @__PURE__ */ function() {
3275
3282
  _defineProperty$e(this, "_logger", null);
3276
3283
  _defineProperty$e(this, "_config", null);
3277
3284
  _defineProperty$e(this, "_url", null);
3285
+ _defineProperty$e(this, "_onStartStreaming", function() {
3286
+ _this2._logger.debug("startstreaming");
3287
+ });
3288
+ _defineProperty$e(this, "_onEndStreaming", function() {
3289
+ _this2._logger.debug("endstreaming");
3290
+ });
3278
3291
  _defineProperty$e(this, "_onSBUpdateEnd", function(type) {
3279
3292
  var queue = _this2._queue[type];
3280
3293
  if (queue) {
@@ -3334,6 +3347,11 @@ var MSE$3 = /* @__PURE__ */ function() {
3334
3347
  get: function get3() {
3335
3348
  return this.mediaSource ? this.mediaSource.readyState === "ended" : false;
3336
3349
  }
3350
+ }, {
3351
+ key: "streaming",
3352
+ get: function get3() {
3353
+ return isMMS(this.mediaSource) ? this.mediaSource.streaming : true;
3354
+ }
3337
3355
  }, {
3338
3356
  key: "isFull",
3339
3357
  value: function isFull(type) {
@@ -3358,12 +3376,12 @@ var MSE$3 = /* @__PURE__ */ function() {
3358
3376
  }
3359
3377
  return this._enqueueBlockingOp(function() {
3360
3378
  if (_this3.isEnded) {
3361
- _this3._logger.debug("[debug mse] setDuration ended");
3379
+ _this3._logger.debug("setDuration but ended");
3362
3380
  return;
3363
3381
  }
3364
3382
  if (_this3.mediaSource) {
3365
3383
  _this3.mediaSource.duration = duration;
3366
- _this3._logger.debug("[debug mse] setDuration");
3384
+ _this3._logger.debug("setDuration", duration);
3367
3385
  }
3368
3386
  }, OP_NAME$3.UPDATE_DURATION, {
3369
3387
  isReduceDuration
@@ -3376,11 +3394,11 @@ var MSE$3 = /* @__PURE__ */ function() {
3376
3394
  if (this._openPromise.used && !this.isOpened && this.mediaSource) {
3377
3395
  var ms = this.mediaSource;
3378
3396
  var onOpen = function onOpen2() {
3379
- var costtime = nowTime$7() - _this4._st;
3380
- _this4._logger.debug("MSE OPEN", costtime);
3397
+ var costTime = nowTime$7() - _this4._st;
3398
+ _this4._logger.debug("sourceopen", costTime);
3381
3399
  ms.removeEventListener("sourceopen", onOpen2);
3382
3400
  _this4._openPromise.resolve({
3383
- costtime
3401
+ costtime: costTime
3384
3402
  });
3385
3403
  };
3386
3404
  ms.addEventListener("sourceopen", onOpen);
@@ -3393,7 +3411,7 @@ var MSE$3 = /* @__PURE__ */ function() {
3393
3411
  value: function() {
3394
3412
  var _bindMedia = _asyncToGenerator$9(/* @__PURE__ */ _regeneratorRuntime$9().mark(function _callee(media) {
3395
3413
  var _this5 = this;
3396
- var ms, onOpen;
3414
+ var MediaSource2, ms, useMMS, onOpen;
3397
3415
  return _regeneratorRuntime$9().wrap(function _callee$(_context) {
3398
3416
  while (1)
3399
3417
  switch (_context.prev = _context.next) {
@@ -3405,29 +3423,36 @@ var MSE$3 = /* @__PURE__ */ function() {
3405
3423
  _context.next = 3;
3406
3424
  return this.unbindMedia();
3407
3425
  case 3:
3408
- if (!(!media || !MediaSource$3)) {
3409
- _context.next = 5;
3426
+ MediaSource2 = getMediaSource$2(this._config.preferMMS);
3427
+ if (!(!media || !MediaSource2)) {
3428
+ _context.next = 6;
3410
3429
  break;
3411
3430
  }
3412
3431
  throw new Error("Param media or MediaSource does not exist");
3413
- case 5:
3432
+ case 6:
3414
3433
  this.media = media;
3415
- ms = this.mediaSource = new MediaSource$3();
3434
+ ms = this.mediaSource = new MediaSource2();
3435
+ useMMS = isMMS(ms);
3416
3436
  this._st = nowTime$7();
3417
3437
  onOpen = function onOpen2() {
3418
- var costtime = nowTime$7() - _this5._st;
3419
- _this5._logger.debug("MSE OPEN");
3438
+ var costTime = nowTime$7() - _this5._st;
3439
+ _this5._logger.debug("sourceopen");
3420
3440
  ms.removeEventListener("sourceopen", onOpen2);
3421
3441
  URL.revokeObjectURL(media.src);
3422
3442
  _this5._openPromise.resolve({
3423
- costtime
3443
+ costtime: costTime
3424
3444
  });
3425
3445
  };
3426
3446
  ms.addEventListener("sourceopen", onOpen);
3447
+ if (useMMS) {
3448
+ ms.addEventListener("startstreaming", this._onStartStreaming);
3449
+ ms.addEventListener("endstreaming", this._onEndStreaming);
3450
+ }
3427
3451
  this._url = URL.createObjectURL(ms);
3428
3452
  media.src = this._url;
3453
+ media.disableRemotePlayback = useMMS;
3429
3454
  return _context.abrupt("return", this._openPromise);
3430
- case 13:
3455
+ case 17:
3431
3456
  case "end":
3432
3457
  return _context.stop();
3433
3458
  }
@@ -3475,8 +3500,13 @@ var MSE$3 = /* @__PURE__ */ function() {
3475
3500
  } catch (error) {
3476
3501
  }
3477
3502
  });
3503
+ if (isMMS(ms)) {
3504
+ ms.removeEventListener("startstreaming", this._onStartStreaming);
3505
+ ms.removeEventListener("endstreaming", this._onEndStreaming);
3506
+ }
3478
3507
  }
3479
3508
  if (this.media) {
3509
+ this.media.disableRemotePlayback = false;
3480
3510
  this.media.removeAttribute("src");
3481
3511
  try {
3482
3512
  this.media.load();
@@ -3609,14 +3639,14 @@ var MSE$3 = /* @__PURE__ */ function() {
3609
3639
  }
3610
3640
  if (!queue || !queue[type] || queue.length < 5)
3611
3641
  return;
3612
- var initOpque = [];
3642
+ var initQueue = [];
3613
3643
  queue.forEach(function(op) {
3614
3644
  if (op.context && op.context.isinit) {
3615
- initOpque.push(op);
3645
+ initQueue.push(op);
3616
3646
  }
3617
3647
  });
3618
3648
  this._queue[type] = queue.slice(0, 2);
3619
- initOpque.length > 0 && (_this$_queue$type = this._queue[type]).push.apply(_this$_queue$type, initOpque);
3649
+ initQueue.length > 0 && (_this$_queue$type = this._queue[type]).push.apply(_this$_queue$type, initQueue);
3620
3650
  }
3621
3651
  }, {
3622
3652
  key: "endOfStream",
@@ -3811,25 +3841,27 @@ var MSE$3 = /* @__PURE__ */ function() {
3811
3841
  }, "abort", context);
3812
3842
  }
3813
3843
  }], [{
3814
- key: "getDefaultConfig",
3815
- value: function getDefaultConfig() {
3816
- return {
3817
- openLog: false
3818
- };
3819
- }
3820
- }, {
3821
3844
  key: "isSupported",
3822
3845
  value: function isSupported2() {
3823
3846
  var mime = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';
3824
- if (!MediaSource$3)
3847
+ var MediaSource2 = getMediaSource$2();
3848
+ if (!MediaSource2)
3825
3849
  return false;
3826
3850
  try {
3827
- return MediaSource$3.isTypeSupported(mime);
3851
+ return MediaSource2.isTypeSupported(mime);
3828
3852
  } catch (error) {
3829
3853
  this._logger.error(mime, error);
3830
3854
  return false;
3831
3855
  }
3832
3856
  }
3857
+ }, {
3858
+ key: "getDefaultConfig",
3859
+ value: function getDefaultConfig() {
3860
+ return {
3861
+ openLog: false,
3862
+ preferMMS: false
3863
+ };
3864
+ }
3833
3865
  }]);
3834
3866
  return MSE2;
3835
3867
  }();
@@ -11240,7 +11272,9 @@ var BufferService$1 = /* @__PURE__ */ function() {
11240
11272
  this._softVideo = softVideo;
11241
11273
  } else {
11242
11274
  this._remuxer = new FMP4Remuxer$3(this._demuxer.videoTrack, this._demuxer.audioTrack);
11243
- this._mse = new MSE$3();
11275
+ this._mse = new MSE$3(null, {
11276
+ preferMMS: typeof opts.preferMMS === "boolean" ? opts.preferMMS : !!opts.perferMMS
11277
+ });
11244
11278
  this._mse.bindMedia(flv.media);
11245
11279
  }
11246
11280
  }
@@ -11250,6 +11284,12 @@ var BufferService$1 = /* @__PURE__ */ function() {
11250
11284
  var _this$_demuxer, _this$_demuxer$_fixer;
11251
11285
  return (_this$_demuxer = this._demuxer) === null || _this$_demuxer === void 0 ? void 0 : (_this$_demuxer$_fixer = _this$_demuxer._fixer) === null || _this$_demuxer$_fixer === void 0 ? void 0 : _this$_demuxer$_fixer._baseDts;
11252
11286
  }
11287
+ }, {
11288
+ key: "blobUrl",
11289
+ get: function get3() {
11290
+ var _this$_mse;
11291
+ return (_this$_mse = this._mse) === null || _this$_mse === void 0 ? void 0 : _this$_mse.url;
11292
+ }
11253
11293
  }, {
11254
11294
  key: "isFull",
11255
11295
  value: function isFull() {
@@ -11715,7 +11755,8 @@ function getOption$1(opts) {
11715
11755
  seamlesslyReload: false,
11716
11756
  keepStatusAfterSwitch: true,
11717
11757
  onlyVideo: false,
11718
- onlyAudio: false
11758
+ onlyAudio: false,
11759
+ preferMMS: false
11719
11760
  }, opts);
11720
11761
  if (ret.isLive) {
11721
11762
  if (ret.preloadTime) {
@@ -11930,7 +11971,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
11930
11971
  _this._gapService.do(media, opts.maxJumpDistance, _this.isLive, 3);
11931
11972
  return;
11932
11973
  }
11933
- if (opts.isLive && bufferEnd > opts.disconnectTime) {
11974
+ if (opts.isLive && media.readyState === 4 && bufferEnd > opts.disconnectTime) {
11934
11975
  _this.disconnect();
11935
11976
  }
11936
11977
  }
@@ -12085,7 +12126,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
12085
12126
  _createClass$j(Flv2, [{
12086
12127
  key: "version",
12087
12128
  get: function get3() {
12088
- return "3.0.12";
12129
+ return "3.0.15-alpha.2";
12089
12130
  }
12090
12131
  }, {
12091
12132
  key: "isLive",
@@ -12108,6 +12149,12 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
12108
12149
  get: function get3() {
12109
12150
  return this._mediaLoader;
12110
12151
  }
12152
+ }, {
12153
+ key: "blobUrl",
12154
+ get: function get3() {
12155
+ var _this$_bufferService3;
12156
+ return (_this$_bufferService3 = this._bufferService) === null || _this$_bufferService3 === void 0 ? void 0 : _this$_bufferService3.blobUrl;
12157
+ }
12111
12158
  }, {
12112
12159
  key: "speedInfo",
12113
12160
  value: function speedInfo() {
@@ -12660,8 +12707,8 @@ var FlvPlugin = /* @__PURE__ */ function(_BasePlugin) {
12660
12707
  BasePlugin.defineGetterOrSetter(this.player, {
12661
12708
  url: {
12662
12709
  get: function get3() {
12663
- var _this2$flv, _this2$flv$media;
12664
- return (_this2$flv = _this2.flv) === null || _this2$flv === void 0 ? void 0 : (_this2$flv$media = _this2$flv.media) === null || _this2$flv$media === void 0 ? void 0 : _this2$flv$media.src;
12710
+ var _this2$flv;
12711
+ return (_this2$flv = _this2.flv) === null || _this2$flv === void 0 ? void 0 : _this2$flv.blobUrl;
12665
12712
  },
12666
12713
  configurable: true
12667
12714
  }
@@ -12740,6 +12787,11 @@ var FlvPlugin = /* @__PURE__ */ function(_BasePlugin) {
12740
12787
  value: function isSupported2(mediaType, codec) {
12741
12788
  return Flv.isSupported(mediaType, codec);
12742
12789
  }
12790
+ }, {
12791
+ key: "isSupportedMMS",
12792
+ value: function isSupportedMMS() {
12793
+ return typeof ManagedMediaSource !== "undefined";
12794
+ }
12743
12795
  }]);
12744
12796
  return FlvPlugin2;
12745
12797
  }(BasePlugin);