stormcloud-video-player 0.8.1 → 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.js CHANGED
@@ -2593,19 +2593,28 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
2593
2593
  });
2594
2594
  this.hls.on(Hls2.Events.MANIFEST_PARSED, function(_, data) {
2595
2595
  return _async_to_generator(function() {
2596
- var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
2596
+ var _ref, _this_config_minSegmentsBeforePlay, _this_hls_levels, _this_hls, prerollKey, adBehavior, minSegments, _this_video_play;
2597
2597
  return _ts_generator(this, function(_state) {
2598
2598
  switch(_state.label){
2599
2599
  case 0:
2600
- if (this.config.allowNativeHls === false) {
2601
- this.isLiveStream = true;
2602
- } else {
2603
- ;
2604
- ;
2605
- 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) {
2606
- var _level_details, _level_details1;
2607
- 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";
2608
- })) !== null && _ref !== void 0 ? _ref : false;
2600
+ 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) {
2601
+ var _level_details, _level_details1;
2602
+ 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";
2603
+ })) !== null && _ref !== void 0 ? _ref : false;
2604
+ if (!this.isLiveStream && this.vmapBreaks.length === 0 && this.apiVastTagUrl) {
2605
+ prerollKey = "synthetic-vod-preroll";
2606
+ if (!this.consumedVmapBreakIds.has(prerollKey)) {
2607
+ this.vmapBreaks = [
2608
+ {
2609
+ id: prerollKey,
2610
+ startTimeMs: 0,
2611
+ vastTagUrl: this.apiVastTagUrl
2612
+ }
2613
+ ];
2614
+ if (this.config.debugAdTiming) {
2615
+ console.log("[StormcloudVideoPlayer] Injected synthetic VOD preroll from apiVastTagUrl");
2616
+ }
2617
+ }
2609
2618
  }
2610
2619
  if (this.config.debugAdTiming) {
2611
2620
  adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
@@ -7061,7 +7070,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7061
7070
  continue;
7062
7071
  }
7063
7072
  var end = breakStartMs + (b.durationMs || 0);
7064
- if (nowMs >= breakStartMs && (b.durationMs ? nowMs < end : nowMs <= breakStartMs + tol)) {
7073
+ var effectiveTol = breakStartMs === 0 ? Math.max(tol, 3e4) : tol;
7074
+ if (nowMs >= breakStartMs && (b.durationMs ? nowMs < end : nowMs <= breakStartMs + effectiveTol)) {
7065
7075
  return b;
7066
7076
  }
7067
7077
  }