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.
@@ -1167,7 +1167,7 @@ function createHlsAdPlayer(contentVideo, options) {
1167
1167
  };
1168
1168
  }
1169
1169
  // src/sdk/pal.ts
1170
- var PAL_SDK_URL = "https://imasdk.googleapis.com/pal/sdkloader/newpallibrary.js";
1170
+ var PAL_SDK_URL = "https://imasdk.googleapis.com/pal/sdkloader/pal.js";
1171
1171
  var _nonceLoader;
1172
1172
  var _palLoadPromise;
1173
1173
  function loadPalSdk() {
@@ -2545,19 +2545,28 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2545
2545
  });
2546
2546
  this.hls.on(import_hls2.default.Events.MANIFEST_PARSED, function(_, data) {
2547
2547
  return _async_to_generator(function() {
2548
- var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
2548
+ var _ref, _this_config_minSegmentsBeforePlay, _this_hls_levels, _this_hls, prerollKey, adBehavior, minSegments, _this_video_play;
2549
2549
  return _ts_generator(this, function(_state) {
2550
2550
  switch(_state.label){
2551
2551
  case 0:
2552
- if (this.config.allowNativeHls === false) {
2553
- this.isLiveStream = true;
2554
- } else {
2555
- ;
2556
- ;
2557
- 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) {
2558
- var _level_details, _level_details1;
2559
- 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";
2560
- })) !== null && _ref !== void 0 ? _ref : false;
2552
+ 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) {
2553
+ var _level_details, _level_details1;
2554
+ 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";
2555
+ })) !== null && _ref !== void 0 ? _ref : false;
2556
+ if (!this.isLiveStream && this.vmapBreaks.length === 0 && this.apiVastTagUrl) {
2557
+ prerollKey = "synthetic-vod-preroll";
2558
+ if (!this.consumedVmapBreakIds.has(prerollKey)) {
2559
+ this.vmapBreaks = [
2560
+ {
2561
+ id: prerollKey,
2562
+ startTimeMs: 0,
2563
+ vastTagUrl: this.apiVastTagUrl
2564
+ }
2565
+ ];
2566
+ if (this.config.debugAdTiming) {
2567
+ console.log("[StormcloudVideoPlayer] Injected synthetic VOD preroll from apiVastTagUrl");
2568
+ }
2569
+ }
2561
2570
  }
2562
2571
  if (this.config.debugAdTiming) {
2563
2572
  adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
@@ -7013,7 +7022,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7013
7022
  continue;
7014
7023
  }
7015
7024
  var end = breakStartMs + (b.durationMs || 0);
7016
- if (nowMs >= breakStartMs && (b.durationMs ? nowMs < end : nowMs <= breakStartMs + tol)) {
7025
+ var effectiveTol = breakStartMs === 0 ? Math.max(tol, 3e4) : tol;
7026
+ if (nowMs >= breakStartMs && (b.durationMs ? nowMs < end : nowMs <= breakStartMs + effectiveTol)) {
7017
7027
  return b;
7018
7028
  }
7019
7029
  }