stormcloud-video-player 0.8.0 → 0.8.2

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.
@@ -1255,7 +1255,7 @@ function createHlsAdPlayer(contentVideo, options) {
1255
1255
  };
1256
1256
  }
1257
1257
  // src/sdk/pal.ts
1258
- var PAL_SDK_URL = "https://imasdk.googleapis.com/pal/sdkloader/newpallibrary.js";
1258
+ var PAL_SDK_URL = "https://imasdk.googleapis.com/pal/sdkloader/pal.js";
1259
1259
  var _nonceLoader;
1260
1260
  var _palLoadPromise;
1261
1261
  function loadPalSdk() {
@@ -2633,19 +2633,28 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2633
2633
  });
2634
2634
  this.hls.on(import_hls2.default.Events.MANIFEST_PARSED, function(_, data) {
2635
2635
  return _async_to_generator(function() {
2636
- var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
2636
+ var _ref, _this_config_minSegmentsBeforePlay, _this_hls_levels, _this_hls, prerollKey, adBehavior, minSegments, _this_video_play;
2637
2637
  return _ts_generator(this, function(_state) {
2638
2638
  switch(_state.label){
2639
2639
  case 0:
2640
- if (this.config.allowNativeHls === false) {
2641
- this.isLiveStream = true;
2642
- } else {
2643
- ;
2644
- ;
2645
- 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) {
2646
- var _level_details, _level_details1;
2647
- 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";
2648
- })) !== null && _ref !== void 0 ? _ref : false;
2640
+ 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) {
2641
+ var _level_details, _level_details1;
2642
+ 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";
2643
+ })) !== null && _ref !== void 0 ? _ref : false;
2644
+ if (!this.isLiveStream && this.vmapBreaks.length === 0 && this.apiVastTagUrl) {
2645
+ prerollKey = "synthetic-vod-preroll";
2646
+ if (!this.consumedVmapBreakIds.has(prerollKey)) {
2647
+ this.vmapBreaks = [
2648
+ {
2649
+ id: prerollKey,
2650
+ startTimeMs: 0,
2651
+ vastTagUrl: this.apiVastTagUrl
2652
+ }
2653
+ ];
2654
+ if (this.config.debugAdTiming) {
2655
+ console.log("[StormcloudVideoPlayer] Injected synthetic VOD preroll from apiVastTagUrl");
2656
+ }
2657
+ }
2649
2658
  }
2650
2659
  if (this.config.debugAdTiming) {
2651
2660
  adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
@@ -7101,7 +7110,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7101
7110
  continue;
7102
7111
  }
7103
7112
  var end = breakStartMs + (b.durationMs || 0);
7104
- if (nowMs >= breakStartMs && (b.durationMs ? nowMs < end : nowMs <= breakStartMs + tol)) {
7113
+ var effectiveTol = breakStartMs === 0 ? Math.max(tol, 3e4) : tol;
7114
+ if (nowMs >= breakStartMs && (b.durationMs ? nowMs < end : nowMs <= breakStartMs + effectiveTol)) {
7105
7115
  return b;
7106
7116
  }
7107
7117
  }