@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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@byteplus/veplayer-plugin",
3
- "version": "2.3.0-rc.4",
3
+ "version": "2.3.1-rc.0",
4
4
  "main": "./umd/index.production.js",
5
5
  "module": "./esm/index.production.js",
6
6
  "browser": "./umd/index.production.js",
@@ -3089,12 +3089,19 @@
3089
3089
  return result;
3090
3090
  }
3091
3091
  function getMediaSource() {
3092
+ var preferMMS = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
3092
3093
  try {
3093
- return isBrowser$1 ? window.MediaSource : null;
3094
+ if (!isBrowser$1)
3095
+ return null;
3096
+ if (preferMMS && typeof ManagedMediaSource !== "undefined")
3097
+ return ManagedMediaSource;
3098
+ return window.MediaSource;
3094
3099
  } catch (e) {
3095
3100
  }
3096
3101
  }
3097
- var MediaSource = getMediaSource();
3102
+ function isMMS(mediaSource) {
3103
+ return /ManagedMediaSource/gi.test(Object.prototype.toString.call(mediaSource));
3104
+ }
3098
3105
  var OP_NAME = {
3099
3106
  APPEND: "appendBuffer",
3100
3107
  REMOVE: "removeBuffer",
@@ -3115,6 +3122,12 @@
3115
3122
  _defineProperty$1(this, "_logger", null);
3116
3123
  _defineProperty$1(this, "_config", null);
3117
3124
  _defineProperty$1(this, "_url", null);
3125
+ _defineProperty$1(this, "_onStartStreaming", function() {
3126
+ _this2._logger.debug("startstreaming");
3127
+ });
3128
+ _defineProperty$1(this, "_onEndStreaming", function() {
3129
+ _this2._logger.debug("endstreaming");
3130
+ });
3118
3131
  _defineProperty$1(this, "_onSBUpdateEnd", function(type) {
3119
3132
  var queue = _this2._queue[type];
3120
3133
  if (queue) {
@@ -3174,6 +3187,11 @@
3174
3187
  get: function get() {
3175
3188
  return this.mediaSource ? this.mediaSource.readyState === "ended" : false;
3176
3189
  }
3190
+ }, {
3191
+ key: "streaming",
3192
+ get: function get() {
3193
+ return isMMS(this.mediaSource) ? this.mediaSource.streaming : true;
3194
+ }
3177
3195
  }, {
3178
3196
  key: "isFull",
3179
3197
  value: function isFull(type) {
@@ -3198,12 +3216,12 @@
3198
3216
  }
3199
3217
  return this._enqueueBlockingOp(function() {
3200
3218
  if (_this3.isEnded) {
3201
- _this3._logger.debug("[debug mse] setDuration ended");
3219
+ _this3._logger.debug("setDuration but ended");
3202
3220
  return;
3203
3221
  }
3204
3222
  if (_this3.mediaSource) {
3205
3223
  _this3.mediaSource.duration = duration;
3206
- _this3._logger.debug("[debug mse] setDuration");
3224
+ _this3._logger.debug("setDuration", duration);
3207
3225
  }
3208
3226
  }, OP_NAME.UPDATE_DURATION, {
3209
3227
  isReduceDuration
@@ -3216,11 +3234,11 @@
3216
3234
  if (this._openPromise.used && !this.isOpened && this.mediaSource) {
3217
3235
  var ms = this.mediaSource;
3218
3236
  var onOpen = function onOpen2() {
3219
- var costtime = nowTime$1() - _this4._st;
3220
- _this4._logger.debug("MSE OPEN", costtime);
3237
+ var costTime = nowTime$1() - _this4._st;
3238
+ _this4._logger.debug("sourceopen", costTime);
3221
3239
  ms.removeEventListener("sourceopen", onOpen2);
3222
3240
  _this4._openPromise.resolve({
3223
- costtime
3241
+ costtime: costTime
3224
3242
  });
3225
3243
  };
3226
3244
  ms.addEventListener("sourceopen", onOpen);
@@ -3233,7 +3251,7 @@
3233
3251
  value: function() {
3234
3252
  var _bindMedia = _asyncToGenerator(/* @__PURE__ */ _regeneratorRuntime().mark(function _callee(media) {
3235
3253
  var _this5 = this;
3236
- var ms, onOpen;
3254
+ var MediaSource, ms, useMMS, onOpen;
3237
3255
  return _regeneratorRuntime().wrap(function _callee$(_context) {
3238
3256
  while (1)
3239
3257
  switch (_context.prev = _context.next) {
@@ -3245,29 +3263,36 @@
3245
3263
  _context.next = 3;
3246
3264
  return this.unbindMedia();
3247
3265
  case 3:
3266
+ MediaSource = getMediaSource(this._config.preferMMS);
3248
3267
  if (!(!media || !MediaSource)) {
3249
- _context.next = 5;
3268
+ _context.next = 6;
3250
3269
  break;
3251
3270
  }
3252
3271
  throw new Error("Param media or MediaSource does not exist");
3253
- case 5:
3272
+ case 6:
3254
3273
  this.media = media;
3255
3274
  ms = this.mediaSource = new MediaSource();
3275
+ useMMS = isMMS(ms);
3256
3276
  this._st = nowTime$1();
3257
3277
  onOpen = function onOpen2() {
3258
- var costtime = nowTime$1() - _this5._st;
3259
- _this5._logger.debug("MSE OPEN");
3278
+ var costTime = nowTime$1() - _this5._st;
3279
+ _this5._logger.debug("sourceopen");
3260
3280
  ms.removeEventListener("sourceopen", onOpen2);
3261
3281
  URL.revokeObjectURL(media.src);
3262
3282
  _this5._openPromise.resolve({
3263
- costtime
3283
+ costtime: costTime
3264
3284
  });
3265
3285
  };
3266
3286
  ms.addEventListener("sourceopen", onOpen);
3287
+ if (useMMS) {
3288
+ ms.addEventListener("startstreaming", this._onStartStreaming);
3289
+ ms.addEventListener("endstreaming", this._onEndStreaming);
3290
+ }
3267
3291
  this._url = URL.createObjectURL(ms);
3268
3292
  media.src = this._url;
3293
+ media.disableRemotePlayback = useMMS;
3269
3294
  return _context.abrupt("return", this._openPromise);
3270
- case 13:
3295
+ case 17:
3271
3296
  case "end":
3272
3297
  return _context.stop();
3273
3298
  }
@@ -3315,8 +3340,13 @@
3315
3340
  } catch (error) {
3316
3341
  }
3317
3342
  });
3343
+ if (isMMS(ms)) {
3344
+ ms.removeEventListener("startstreaming", this._onStartStreaming);
3345
+ ms.removeEventListener("endstreaming", this._onEndStreaming);
3346
+ }
3318
3347
  }
3319
3348
  if (this.media) {
3349
+ this.media.disableRemotePlayback = false;
3320
3350
  this.media.removeAttribute("src");
3321
3351
  try {
3322
3352
  this.media.load();
@@ -3449,14 +3479,14 @@
3449
3479
  }
3450
3480
  if (!queue || !queue[type] || queue.length < 5)
3451
3481
  return;
3452
- var initOpque = [];
3482
+ var initQueue = [];
3453
3483
  queue.forEach(function(op) {
3454
3484
  if (op.context && op.context.isinit) {
3455
- initOpque.push(op);
3485
+ initQueue.push(op);
3456
3486
  }
3457
3487
  });
3458
3488
  this._queue[type] = queue.slice(0, 2);
3459
- initOpque.length > 0 && (_this$_queue$type = this._queue[type]).push.apply(_this$_queue$type, initOpque);
3489
+ initQueue.length > 0 && (_this$_queue$type = this._queue[type]).push.apply(_this$_queue$type, initQueue);
3460
3490
  }
3461
3491
  }, {
3462
3492
  key: "endOfStream",
@@ -3651,16 +3681,10 @@
3651
3681
  }, "abort", context);
3652
3682
  }
3653
3683
  }], [{
3654
- key: "getDefaultConfig",
3655
- value: function getDefaultConfig() {
3656
- return {
3657
- openLog: false
3658
- };
3659
- }
3660
- }, {
3661
3684
  key: "isSupported",
3662
3685
  value: function isSupported() {
3663
3686
  var mime = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 'video/mp4; codecs="avc1.42E01E,mp4a.40.2"';
3687
+ var MediaSource = getMediaSource();
3664
3688
  if (!MediaSource)
3665
3689
  return false;
3666
3690
  try {
@@ -3670,6 +3694,14 @@
3670
3694
  return false;
3671
3695
  }
3672
3696
  }
3697
+ }, {
3698
+ key: "getDefaultConfig",
3699
+ value: function getDefaultConfig() {
3700
+ return {
3701
+ openLog: false,
3702
+ preferMMS: false
3703
+ };
3704
+ }
3673
3705
  }]);
3674
3706
  return MSE2;
3675
3707
  }();
@@ -9413,7 +9445,9 @@
9413
9445
  this._softVideo = softVideo;
9414
9446
  } else {
9415
9447
  this._remuxer = new FMP4Remuxer(this._demuxer.videoTrack, this._demuxer.audioTrack);
9416
- this._mse = new MSE();
9448
+ this._mse = new MSE(null, {
9449
+ preferMMS: typeof opts.preferMMS === "boolean" ? opts.preferMMS : !!opts.perferMMS
9450
+ });
9417
9451
  this._mse.bindMedia(flv.media);
9418
9452
  }
9419
9453
  }
@@ -9423,6 +9457,12 @@
9423
9457
  var _this$_demuxer, _this$_demuxer$_fixer;
9424
9458
  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;
9425
9459
  }
9460
+ }, {
9461
+ key: "blobUrl",
9462
+ get: function get() {
9463
+ var _this$_mse;
9464
+ return (_this$_mse = this._mse) === null || _this$_mse === void 0 ? void 0 : _this$_mse.url;
9465
+ }
9426
9466
  }, {
9427
9467
  key: "isFull",
9428
9468
  value: function isFull() {
@@ -9888,7 +9928,8 @@
9888
9928
  seamlesslyReload: false,
9889
9929
  keepStatusAfterSwitch: true,
9890
9930
  onlyVideo: false,
9891
- onlyAudio: false
9931
+ onlyAudio: false,
9932
+ preferMMS: false
9892
9933
  }, opts);
9893
9934
  if (ret.isLive) {
9894
9935
  if (ret.preloadTime) {
@@ -10103,7 +10144,7 @@
10103
10144
  _this._gapService.do(media, opts.maxJumpDistance, _this.isLive, 3);
10104
10145
  return;
10105
10146
  }
10106
- if (opts.isLive && bufferEnd > opts.disconnectTime) {
10147
+ if (opts.isLive && media.readyState === 4 && bufferEnd > opts.disconnectTime) {
10107
10148
  _this.disconnect();
10108
10149
  }
10109
10150
  }
@@ -10258,7 +10299,7 @@
10258
10299
  _createClass$4(Flv2, [{
10259
10300
  key: "version",
10260
10301
  get: function get() {
10261
- return "3.0.12";
10302
+ return "3.0.15-alpha.2";
10262
10303
  }
10263
10304
  }, {
10264
10305
  key: "isLive",
@@ -10281,6 +10322,12 @@
10281
10322
  get: function get() {
10282
10323
  return this._mediaLoader;
10283
10324
  }
10325
+ }, {
10326
+ key: "blobUrl",
10327
+ get: function get() {
10328
+ var _this$_bufferService3;
10329
+ return (_this$_bufferService3 = this._bufferService) === null || _this$_bufferService3 === void 0 ? void 0 : _this$_bufferService3.blobUrl;
10330
+ }
10284
10331
  }, {
10285
10332
  key: "speedInfo",
10286
10333
  value: function speedInfo() {
@@ -10833,8 +10880,8 @@
10833
10880
  BasePlugin.defineGetterOrSetter(this.player, {
10834
10881
  url: {
10835
10882
  get: function get() {
10836
- var _this2$flv, _this2$flv$media;
10837
- 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;
10883
+ var _this2$flv;
10884
+ return (_this2$flv = _this2.flv) === null || _this2$flv === void 0 ? void 0 : _this2$flv.blobUrl;
10838
10885
  },
10839
10886
  configurable: true
10840
10887
  }
@@ -10913,6 +10960,11 @@
10913
10960
  value: function isSupported(mediaType, codec) {
10914
10961
  return Flv.isSupported(mediaType, codec);
10915
10962
  }
10963
+ }, {
10964
+ key: "isSupportedMMS",
10965
+ value: function isSupportedMMS() {
10966
+ return typeof ManagedMediaSource !== "undefined";
10967
+ }
10916
10968
  }]);
10917
10969
  return FlvPlugin2;
10918
10970
  }(BasePlugin);