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.
@@ -1,5 +1,5 @@
1
1
  import { Component } from 'react';
2
- import { S as StormcloudVideoPlayerConfig } from '../types-XKUJJhlG.cjs';
2
+ import { S as StormcloudVideoPlayerConfig } from '../types-BJPNhfLV.cjs';
3
3
 
4
4
  interface HlsPlayerProps extends StormcloudVideoPlayerConfig {
5
5
  onMount?: (player: any) => void;
@@ -3425,7 +3425,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3425
3425
  key: "load",
3426
3426
  value: function load() {
3427
3427
  return _async_to_generator(function() {
3428
- var _this, error, _this_config_lowLatencyMode, _this_video_play;
3428
+ var _this, error, _this_config_isLiveStream, _this_config_lowLatencyMode, _this_video_play;
3429
3429
  return _ts_generator(this, function(_state) {
3430
3430
  switch(_state.label){
3431
3431
  case 0:
@@ -3469,7 +3469,7 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3469
3469
  this.nativeHlsMode = true;
3470
3470
  this.videoSrcProtection = this.config.src;
3471
3471
  this.video.src = this.config.src;
3472
- this.isLiveStream = (_this_config_lowLatencyMode = this.config.lowLatencyMode) !== null && _this_config_lowLatencyMode !== void 0 ? _this_config_lowLatencyMode : false;
3472
+ 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;
3473
3473
  if (this.config.debugAdTiming) {
3474
3474
  console.log("[StormcloudVideoPlayer] Using native HLS playback - VOD mode:", {
3475
3475
  isLive: this.isLiveStream,
@@ -3520,19 +3520,28 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
3520
3520
  });
3521
3521
  this.hls.on(import_hls2.default.Events.MANIFEST_PARSED, function(_, data) {
3522
3522
  return _async_to_generator(function() {
3523
- var _this_config_minSegmentsBeforePlay, _ref, _this_hls_levels, _this_hls, adBehavior, minSegments, _this_video_play;
3523
+ var _this_config_isLiveStream, _ref, _this_config_minSegmentsBeforePlay, _this_hls_levels, _this_hls, prerollKey, adBehavior, minSegments, _this_video_play;
3524
3524
  return _ts_generator(this, function(_state) {
3525
3525
  switch(_state.label){
3526
3526
  case 0:
3527
- if (this.config.allowNativeHls === false) {
3528
- this.isLiveStream = true;
3529
- } else {
3530
- ;
3531
- ;
3532
- 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) {
3533
- var _level_details, _level_details1;
3534
- 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";
3535
- })) !== null && _ref !== void 0 ? _ref : false;
3527
+ 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) {
3528
+ var _level_details, _level_details1;
3529
+ 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";
3530
+ })) !== null && _ref !== void 0 ? _ref : false;
3531
+ if (!this.isLiveStream && this.vmapBreaks.length === 0 && this.apiVastTagUrl) {
3532
+ prerollKey = "synthetic-vod-preroll";
3533
+ if (!this.consumedVmapBreakIds.has(prerollKey)) {
3534
+ this.vmapBreaks = [
3535
+ {
3536
+ id: prerollKey,
3537
+ startTimeMs: 0,
3538
+ vastTagUrl: this.apiVastTagUrl
3539
+ }
3540
+ ];
3541
+ if (this.config.debugAdTiming) {
3542
+ console.log("[StormcloudVideoPlayer] Injected synthetic VOD preroll from apiVastTagUrl");
3543
+ }
3544
+ }
3536
3545
  }
3537
3546
  if (this.config.debugAdTiming) {
3538
3547
  adBehavior = this.shouldContinueLiveStreamDuringAds() ? "live (main video continues muted during ads)" : "vod (main video pauses during ads)";
@@ -7970,7 +7979,8 @@ var StormcloudVideoPlayer = /*#__PURE__*/ function() {
7970
7979
  continue;
7971
7980
  }
7972
7981
  var end = breakStartMs + (b.durationMs || 0);
7973
- if (nowMs >= breakStartMs && (b.durationMs ? nowMs < end : nowMs <= breakStartMs + tol)) {
7982
+ var effectiveTol = breakStartMs === 0 ? Math.max(tol, 3e4) : tol;
7983
+ if (nowMs >= breakStartMs && (b.durationMs ? nowMs < end : nowMs <= breakStartMs + effectiveTol)) {
7974
7984
  return b;
7975
7985
  }
7976
7986
  }