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.
package/lib/index.cjs CHANGED
@@ -1358,7 +1358,7 @@ function createHlsAdPlayer(contentVideo, options) {
1358
1358
  };
1359
1359
  }
1360
1360
  // src/sdk/pal.ts
1361
- var PAL_SDK_URL = "https://imasdk.googleapis.com/pal/sdkloader/newpallibrary.js";
1361
+ var PAL_SDK_URL = "https://imasdk.googleapis.com/pal/sdkloader/pal.js";
1362
1362
  var _nonceLoader;
1363
1363
  var _palLoadPromise;
1364
1364
  function loadPalSdk() {
@@ -2759,19 +2759,28 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2759
2759
  });
2760
2760
  this.hls.on(import_hls2.default.Events.MANIFEST_PARSED, function(_, data) {
2761
2761
  return _async_to_generator(function() {
2762
- var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
2762
+ var _ref, _this_config_minSegmentsBeforePlay, _this_hls_levels, _this_hls, prerollKey, adBehavior, minSegments, _this_video_play;
2763
2763
  return _ts_generator(this, function(_state) {
2764
2764
  switch(_state.label){
2765
2765
  case 0:
2766
- if (this.config.allowNativeHls === false) {
2767
- this.isLiveStream = true;
2768
- } else {
2769
- ;
2770
- ;
2771
- 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) {
2772
- var _level_details, _level_details1;
2773
- 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";
2774
- })) !== null && _ref !== void 0 ? _ref : false;
2766
+ 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) {
2767
+ var _level_details, _level_details1;
2768
+ 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";
2769
+ })) !== null && _ref !== void 0 ? _ref : false;
2770
+ if (!this.isLiveStream && this.vmapBreaks.length === 0 && this.apiVastTagUrl) {
2771
+ prerollKey = "synthetic-vod-preroll";
2772
+ if (!this.consumedVmapBreakIds.has(prerollKey)) {
2773
+ this.vmapBreaks = [
2774
+ {
2775
+ id: prerollKey,
2776
+ startTimeMs: 0,
2777
+ vastTagUrl: this.apiVastTagUrl
2778
+ }
2779
+ ];
2780
+ if (this.config.debugAdTiming) {
2781
+ console.log("[StormcloudVideoPlayer] Injected synthetic VOD preroll from apiVastTagUrl");
2782
+ }
2783
+ }
2775
2784
  }
2776
2785
  if (this.config.debugAdTiming) {
2777
2786
  adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
@@ -7227,7 +7236,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7227
7236
  continue;
7228
7237
  }
7229
7238
  var end = breakStartMs + (b.durationMs || 0);
7230
- if (nowMs >= breakStartMs && (b.durationMs ? nowMs < end : nowMs <= breakStartMs + tol)) {
7239
+ var effectiveTol = breakStartMs === 0 ? Math.max(tol, 3e4) : tol;
7240
+ if (nowMs >= breakStartMs && (b.durationMs ? nowMs < end : nowMs <= breakStartMs + effectiveTol)) {
7231
7241
  return b;
7232
7242
  }
7233
7243
  }