@byteplus/veplayer-plugin 2.3.0-rc.4 → 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
@@ -3085,12 +3085,19 @@ function logable(obj, maxDepth, depth) {
3085
3085
  return result;
3086
3086
  }
3087
3087
  function getMediaSource() {
3088
+ var preferMMS = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
3088
3089
  try {
3089
- return isBrowser$1 ? window.MediaSource : null;
3090
+ if (!isBrowser$1)
3091
+ return null;
3092
+ if (preferMMS && typeof ManagedMediaSource !== "undefined")
3093
+ return ManagedMediaSource;
3094
+ return window.MediaSource;
3090
3095
  } catch (e) {
3091
3096
  }
3092
3097
  }
3093
- var MediaSource = getMediaSource();
3098
+ function isMMS(mediaSource) {
3099
+ return /ManagedMediaSource/gi.test(Object.prototype.toString.call(mediaSource));
3100
+ }
3094
3101
  var OP_NAME = {
3095
3102
  APPEND: "appendBuffer",
3096
3103
  REMOVE: "removeBuffer",
@@ -3111,6 +3118,12 @@ var MSE = /* @__PURE__ */ function() {
3111
3118
  _defineProperty$1(this, "_logger", null);
3112
3119
  _defineProperty$1(this, "_config", null);
3113
3120
  _defineProperty$1(this, "_url", null);
3121
+ _defineProperty$1(this, "_onStartStreaming", function() {
3122
+ _this2._logger.debug("startstreaming");
3123
+ });
3124
+ _defineProperty$1(this, "_onEndStreaming", function() {
3125
+ _this2._logger.debug("endstreaming");
3126
+ });
3114
3127
  _defineProperty$1(this, "_onSBUpdateEnd", function(type) {
3115
3128
  var queue = _this2._queue[type];
3116
3129
  if (queue) {
@@ -3170,6 +3183,11 @@ var MSE = /* @__PURE__ */ function() {
3170
3183
  get: function get() {
3171
3184
  return this.mediaSource ? this.mediaSource.readyState === "ended" : false;
3172
3185
  }
3186
+ }, {
3187
+ key: "streaming",
3188
+ get: function get() {
3189
+ return isMMS(this.mediaSource) ? this.mediaSource.streaming : true;
3190
+ }
3173
3191
  }, {
3174
3192
  key: "isFull",
3175
3193
  value: function isFull(type) {
@@ -3194,12 +3212,12 @@ var MSE = /* @__PURE__ */ function() {
3194
3212
  }
3195
3213
  return this._enqueueBlockingOp(function() {
3196
3214
  if (_this3.isEnded) {
3197
- _this3._logger.debug("[debug mse] setDuration ended");
3215
+ _this3._logger.debug("setDuration but ended");
3198
3216
  return;
3199
3217
  }
3200
3218
  if (_this3.mediaSource) {
3201
3219
  _this3.mediaSource.duration = duration;
3202
- _this3._logger.debug("[debug mse] setDuration");
3220
+ _this3._logger.debug("setDuration", duration);
3203
3221
  }
3204
3222
  }, OP_NAME.UPDATE_DURATION, {
3205
3223
  isReduceDuration
@@ -3212,11 +3230,11 @@ var MSE = /* @__PURE__ */ function() {
3212
3230
  if (this._openPromise.used && !this.isOpened && this.mediaSource) {
3213
3231
  var ms = this.mediaSource;
3214
3232
  var onOpen = function onOpen2() {
3215
- var costtime = nowTime$1() - _this4._st;
3216
- _this4._logger.debug("MSE OPEN", costtime);
3233
+ var costTime = nowTime$1() - _this4._st;
3234
+ _this4._logger.debug("sourceopen", costTime);
3217
3235
  ms.removeEventListener("sourceopen", onOpen2);
3218
3236
  _this4._openPromise.resolve({
3219
- costtime
3237
+ costtime: costTime
3220
3238
  });
3221
3239
  };
3222
3240
  ms.addEventListener("sourceopen", onOpen);
@@ -3229,7 +3247,7 @@ var MSE = /* @__PURE__ */ function() {
3229
3247
  value: function() {
3230
3248
  var _bindMedia = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(media) {
3231
3249
  var _this5 = this;
3232
- var ms, onOpen;
3250
+ var MediaSource, ms, useMMS, onOpen;
3233
3251
  return _regeneratorRuntime().wrap(function _callee$(_context) {
3234
3252
  while (1)
3235
3253
  switch (_context.prev = _context.next) {
@@ -3241,29 +3259,36 @@ var MSE = /* @__PURE__ */ function() {
3241
3259
  _context.next = 3;
3242
3260
  return this.unbindMedia();
3243
3261
  case 3:
3262
+ MediaSource = getMediaSource(this._config.preferMMS);
3244
3263
  if (!(!media || !MediaSource)) {
3245
- _context.next = 5;
3264
+ _context.next = 6;
3246
3265
  break;
3247
3266
  }
3248
3267
  throw new Error("Param media or MediaSource does not exist");
3249
- case 5:
3268
+ case 6:
3250
3269
  this.media = media;
3251
3270
  ms = this.mediaSource = new MediaSource();
3271
+ useMMS = isMMS(ms);
3252
3272
  this._st = nowTime$1();
3253
3273
  onOpen = function onOpen2() {
3254
- var costtime = nowTime$1() - _this5._st;
3255
- _this5._logger.debug("MSE OPEN");
3274
+ var costTime = nowTime$1() - _this5._st;
3275
+ _this5._logger.debug("sourceopen");
3256
3276
  ms.removeEventListener("sourceopen", onOpen2);
3257
3277
  URL.revokeObjectURL(media.src);
3258
3278
  _this5._openPromise.resolve({
3259
- costtime
3279
+ costtime: costTime
3260
3280
  });
3261
3281
  };
3262
3282
  ms.addEventListener("sourceopen", onOpen);
3283
+ if (useMMS) {
3284
+ ms.addEventListener("startstreaming", this._onStartStreaming);
3285
+ ms.addEventListener("endstreaming", this._onEndStreaming);
3286
+ }
3263
3287
  this._url = URL.createObjectURL(ms);
3264
3288
  media.src = this._url;
3289
+ media.disableRemotePlayback = useMMS;
3265
3290
  return _context.abrupt("return", this._openPromise);
3266
- case 13:
3291
+ case 17:
3267
3292
  case "end":
3268
3293
  return _context.stop();
3269
3294
  }
@@ -3311,8 +3336,13 @@ var MSE = /* @__PURE__ */ function() {
3311
3336
  } catch (error) {
3312
3337
  }
3313
3338
  });
3339
+ if (isMMS(ms)) {
3340
+ ms.removeEventListener("startstreaming", this._onStartStreaming);
3341
+ ms.removeEventListener("endstreaming", this._onEndStreaming);
3342
+ }
3314
3343
  }
3315
3344
  if (this.media) {
3345
+ this.media.disableRemotePlayback = false;
3316
3346
  this.media.removeAttribute("src");
3317
3347
  try {
3318
3348
  this.media.load();
@@ -3445,14 +3475,14 @@ var MSE = /* @__PURE__ */ function() {
3445
3475
  }
3446
3476
  if (!queue || !queue[type] || queue.length < 5)
3447
3477
  return;
3448
- var initOpque = [];
3478
+ var initQueue = [];
3449
3479
  queue.forEach(function(op) {
3450
3480
  if (op.context && op.context.isinit) {
3451
- initOpque.push(op);
3481
+ initQueue.push(op);
3452
3482
  }
3453
3483
  });
3454
3484
  this._queue[type] = queue.slice(0, 2);
3455
- initOpque.length > 0 && (_this$_queue$type = this._queue[type]).push.apply(_this$_queue$type, initOpque);
3485
+ initQueue.length > 0 && (_this$_queue$type = this._queue[type]).push.apply(_this$_queue$type, initQueue);
3456
3486
  }
3457
3487
  }, {
3458
3488
  key: "endOfStream",
@@ -3647,16 +3677,10 @@ var MSE = /* @__PURE__ */ function() {
3647
3677
  }, "abort", context);
3648
3678
  }
3649
3679
  }], [{
3650
- key: "getDefaultConfig",
3651
- value: function getDefaultConfig() {
3652
- return {
3653
- openLog: false
3654
- };
3655
- }
3656
- }, {
3657
3680
  key: "isSupported",
3658
3681
  value: function isSupported() {
3659
3682
  var mime = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';
3683
+ var MediaSource = getMediaSource();
3660
3684
  if (!MediaSource)
3661
3685
  return false;
3662
3686
  try {
@@ -3666,6 +3690,14 @@ var MSE = /* @__PURE__ */ function() {
3666
3690
  return false;
3667
3691
  }
3668
3692
  }
3693
+ }, {
3694
+ key: "getDefaultConfig",
3695
+ value: function getDefaultConfig() {
3696
+ return {
3697
+ openLog: false,
3698
+ preferMMS: false
3699
+ };
3700
+ }
3669
3701
  }]);
3670
3702
  return MSE2;
3671
3703
  }();
@@ -9409,7 +9441,9 @@ var BufferService = /* @__PURE__ */ function() {
9409
9441
  this._softVideo = softVideo;
9410
9442
  } else {
9411
9443
  this._remuxer = new FMP4Remuxer(this._demuxer.videoTrack, this._demuxer.audioTrack);
9412
- this._mse = new MSE();
9444
+ this._mse = new MSE(null, {
9445
+ preferMMS: typeof opts.preferMMS === "boolean" ? opts.preferMMS : !!opts.perferMMS
9446
+ });
9413
9447
  this._mse.bindMedia(flv.media);
9414
9448
  }
9415
9449
  }
@@ -9419,6 +9453,12 @@ var BufferService = /* @__PURE__ */ function() {
9419
9453
  var _this$_demuxer, _this$_demuxer$_fixer;
9420
9454
  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;
9421
9455
  }
9456
+ }, {
9457
+ key: "blobUrl",
9458
+ get: function get() {
9459
+ var _this$_mse;
9460
+ return (_this$_mse = this._mse) === null || _this$_mse === void 0 ? void 0 : _this$_mse.url;
9461
+ }
9422
9462
  }, {
9423
9463
  key: "isFull",
9424
9464
  value: function isFull() {
@@ -9884,7 +9924,8 @@ function getOption(opts) {
9884
9924
  seamlesslyReload: false,
9885
9925
  keepStatusAfterSwitch: true,
9886
9926
  onlyVideo: false,
9887
- onlyAudio: false
9927
+ onlyAudio: false,
9928
+ preferMMS: false
9888
9929
  }, opts);
9889
9930
  if (ret.isLive) {
9890
9931
  if (ret.preloadTime) {
@@ -10099,7 +10140,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
10099
10140
  _this._gapService.do(media, opts.maxJumpDistance, _this.isLive, 3);
10100
10141
  return;
10101
10142
  }
10102
- if (opts.isLive && bufferEnd > opts.disconnectTime) {
10143
+ if (opts.isLive && media.readyState === 4 && bufferEnd > opts.disconnectTime) {
10103
10144
  _this.disconnect();
10104
10145
  }
10105
10146
  }
@@ -10254,7 +10295,7 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
10254
10295
  _createClass$4(Flv2, [{
10255
10296
  key: "version",
10256
10297
  get: function get() {
10257
- return "3.0.12";
10298
+ return "3.0.15-alpha.2";
10258
10299
  }
10259
10300
  }, {
10260
10301
  key: "isLive",
@@ -10277,6 +10318,12 @@ var Flv = /* @__PURE__ */ function(_EventEmitter) {
10277
10318
  get: function get() {
10278
10319
  return this._mediaLoader;
10279
10320
  }
10321
+ }, {
10322
+ key: "blobUrl",
10323
+ get: function get() {
10324
+ var _this$_bufferService3;
10325
+ return (_this$_bufferService3 = this._bufferService) === null || _this$_bufferService3 === void 0 ? void 0 : _this$_bufferService3.blobUrl;
10326
+ }
10280
10327
  }, {
10281
10328
  key: "speedInfo",
10282
10329
  value: function speedInfo() {
@@ -10829,8 +10876,8 @@ var FlvPlugin = /* @__PURE__ */ function(_BasePlugin) {
10829
10876
  BasePlugin.defineGetterOrSetter(this.player, {
10830
10877
  url: {
10831
10878
  get: function get() {
10832
- var _this2$flv, _this2$flv$media;
10833
- 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;
10879
+ var _this2$flv;
10880
+ return (_this2$flv = _this2.flv) === null || _this2$flv === void 0 ? void 0 : _this2$flv.blobUrl;
10834
10881
  },
10835
10882
  configurable: true
10836
10883
  }
@@ -10909,6 +10956,11 @@ var FlvPlugin = /* @__PURE__ */ function(_BasePlugin) {
10909
10956
  value: function isSupported(mediaType, codec) {
10910
10957
  return Flv.isSupported(mediaType, codec);
10911
10958
  }
10959
+ }, {
10960
+ key: "isSupportedMMS",
10961
+ value: function isSupportedMMS() {
10962
+ return typeof ManagedMediaSource !== "undefined";
10963
+ }
10912
10964
  }]);
10913
10965
  return FlvPlugin2;
10914
10966
  }(BasePlugin);