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.
@@ -3337,7 +3337,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3337
3337
  key: "load",
3338
3338
  value: function load() {
3339
3339
  return _async_to_generator(function() {
3340
- var _this, error, _this_config_lowLatencyMode, _this_video_play;
3340
+ var _this, error, _this_config_isLiveStream, _this_config_lowLatencyMode, _this_video_play;
3341
3341
  return _ts_generator(this, function(_state) {
3342
3342
  switch(_state.label){
3343
3343
  case 0:
@@ -3381,7 +3381,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3381
3381
  this.nativeHlsMode = true;
3382
3382
  this.videoSrcProtection = this.config.src;
3383
3383
  this.video.src = this.config.src;
3384
- this.isLiveStream = (_this_config_lowLatencyMode = this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false;
3384
+ 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;
3385
3385
  if (this.config.debugAdTiming) {
3386
3386
  console.log("[StormcloudVideoPlayer] Using native HLS playback - VOD mode:", {
3387
3387
  isLive: this.isLiveStream,
@@ -3432,19 +3432,28 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3432
3432
  });
3433
3433
  this.hls.on(import_hls2.default.Events.MANIFEST_PARSED, function(_, data) {
3434
3434
  return _async_to_generator(function() {
3435
- var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
3435
+ var _this_config_isLiveStream, _ref, _this_config_minSegmentsBeforePlay, _this_hls_levels, _this_hls, prerollKey, adBehavior, minSegments, _this_video_play;
3436
3436
  return _ts_generator(this, function(_state) {
3437
3437
  switch(_state.label){
3438
3438
  case 0:
3439
- if (this.config.allowNativeHls === false) {
3440
- this.isLiveStream = true;
3441
- } else {
3442
- ;
3443
- ;
3444
- 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) {
3445
- var _level_details, _level_details1;
3446
- 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";
3447
- })) !== null && _ref !== void 0 ? _ref : false;
3439
+ 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) {
3440
+ var _level_details, _level_details1;
3441
+ 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";
3442
+ })) !== null && _ref !== void 0 ? _ref : false;
3443
+ if (!this.isLiveStream && this.vmapBreaks.length === 0 && this.apiVastTagUrl) {
3444
+ prerollKey = "synthetic-vod-preroll";
3445
+ if (!this.consumedVmapBreakIds.has(prerollKey)) {
3446
+ this.vmapBreaks = [
3447
+ {
3448
+ id: prerollKey,
3449
+ startTimeMs: 0,
3450
+ vastTagUrl: this.apiVastTagUrl
3451
+ }
3452
+ ];
3453
+ if (this.config.debugAdTiming) {
3454
+ console.log("[StormcloudVideoPlayer] Injected synthetic VOD preroll from apiVastTagUrl");
3455
+ }
3456
+ }
3448
3457
  }
3449
3458
  if (this.config.debugAdTiming) {
3450
3459
  adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
@@ -7882,7 +7891,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7882
7891
  continue;
7883
7892
  }
7884
7893
  var end = breakStartMs + (b.durationMs || 0);
7885
- if (nowMs >= breakStartMs && (b.durationMs ? nowMs < end : nowMs <= breakStartMs + tol)) {
7894
+ var effectiveTol = breakStartMs === 0 ? Math.max(tol, 3e4) : tol;
7895
+ if (nowMs >= breakStartMs && (b.durationMs ? nowMs < end : nowMs <= breakStartMs + effectiveTol)) {
7886
7896
  return b;
7887
7897
  }
7888
7898
  }