stormcloud-video-player 0.3.61 → 0.3.62

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.
@@ -1,4 +1,4 @@
1
- import { S as StormcloudVideoPlayerConfig } from '../types-XKUJJhlG.cjs';
1
+ import { S as StormcloudVideoPlayerConfig } from '../types-BJPNhfLV.cjs';
2
2
 
3
3
  declare class StormcloudVideoPlayer {
4
4
  private readonly video;
@@ -3389,7 +3389,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3389
3389
  key: "load",
3390
3390
  value: function load() {
3391
3391
  return _async_to_generator(function() {
3392
- var _this, error, _this_config_lowLatencyMode, _this_video_play;
3392
+ var _this, error, _this_config_isLiveStream, _this_config_lowLatencyMode, _this_video_play;
3393
3393
  return _ts_generator(this, function(_state) {
3394
3394
  switch(_state.label){
3395
3395
  case 0:
@@ -3433,7 +3433,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3433
3433
  this.nativeHlsMode = true;
3434
3434
  this.videoSrcProtection = this.config.src;
3435
3435
  this.video.src = this.config.src;
3436
- this.isLiveStream = (_this_config_lowLatencyMode = this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false;
3436
+ this.isLiveStream = (_this_config_isLiveStream = this.config.isLiveStream) !== null && _this_config_isLiveStream !== void 0 ? _this_config_isLiveStream : (_this_config_lowLatencyMode = this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false;
3437
3437
  if (this.config.debugAdTiming) {
3438
3438
  console.log("[StormcloudVideoPlayer] Using native HLS playback - VOD mode:", {
3439
3439
  isLive: this.isLiveStream,
@@ -3484,19 +3484,28 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3484
3484
  });
3485
3485
  this.hls.on(import_hls2.default.Events.MANIFEST_PARSED, function(_, data) {
3486
3486
  return _async_to_generator(function() {
3487
- var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
3487
+ var _this_config_isLiveStream, _ref, _this_config_minSegmentsBeforePlay, _this_hls_levels, _this_hls, prerollKey, adBehavior, minSegments, _this_video_play;
3488
3488
  return _ts_generator(this, function(_state) {
3489
3489
  switch(_state.label){
3490
3490
  case 0:
3491
- if (this.config.allowNativeHls === false) {
3492
- this.isLiveStream = true;
3493
- } else {
3494
- ;
3495
- ;
3496
- this.isLiveStream = (_ref = (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : (_this_hls_levels = _this_hls.levels) === null || _this_hls_levels === void 0 ? void 0 : _this_hls_levels.some(function(level) {
3497
- var _level_details, _level_details1;
3498
- return (level === null || level === void 0 ? void 0 : (_level_details = level.details) === null || _level_details === void 0 ? void 0 : _level_details.live) === true || (level === null || level === void 0 ? void 0 : (_level_details1 = level.details) === null || _level_details1 === void 0 ? void 0 : _level_details1.type) === "LIVE";
3499
- })) !== null && _ref !== void 0 ? _ref : false;
3491
+ this.isLiveStream = (_this_config_isLiveStream = this.config.isLiveStream) !== null && _this_config_isLiveStream !== void 0 ? _this_config_isLiveStream : (_ref = (_this_hls = this.hls) === null || _this_hls === void 0 ? void 0 : (_this_hls_levels = _this_hls.levels) === null || _this_hls_levels === void 0 ? void 0 : _this_hls_levels.some(function(level) {
3492
+ var _level_details, _level_details1;
3493
+ return (level === null || level === void 0 ? void 0 : (_level_details = level.details) === null || _level_details === void 0 ? void 0 : _level_details.live) === true || (level === null || level === void 0 ? void 0 : (_level_details1 = level.details) === null || _level_details1 === void 0 ? void 0 : _level_details1.type) === "LIVE";
3494
+ })) !== null && _ref !== void 0 ? _ref : false;
3495
+ if (!this.isLiveStream && this.vmapBreaks.length === 0 && this.apiVastTagUrl) {
3496
+ prerollKey = "synthetic-vod-preroll";
3497
+ if (!this.consumedVmapBreakIds.has(prerollKey)) {
3498
+ this.vmapBreaks = [
3499
+ {
3500
+ id: prerollKey,
3501
+ startTimeMs: 0,
3502
+ vastTagUrl: this.apiVastTagUrl
3503
+ }
3504
+ ];
3505
+ if (this.config.debugAdTiming) {
3506
+ console.log("[StormcloudVideoPlayer] Injected synthetic VOD preroll from apiVastTagUrl");
3507
+ }
3508
+ }
3500
3509
  }
3501
3510
  if (this.config.debugAdTiming) {
3502
3511
  adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
@@ -7934,7 +7943,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7934
7943
  continue;
7935
7944
  }
7936
7945
  var end = breakStartMs + (b.durationMs || 0);
7937
- if (nowMs >= breakStartMs && (b.durationMs ? nowMs < end : nowMs <= breakStartMs + tol)) {
7946
+ var effectiveTol = breakStartMs === 0 ? Math.max(tol, 3e4) : tol;
7947
+ if (nowMs >= breakStartMs && (b.durationMs ? nowMs < end : nowMs <= breakStartMs + effectiveTol)) {
7938
7948
  return b;
7939
7949
  }
7940
7950
  }