stormcloud-video-player 0.8.51 → 0.8.52

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-iDjS8f_7.cjs';
2
+ import { a as StormcloudVideoPlayerConfig } from '../types-cTqIKw_D.cjs';
3
3
 
4
4
  interface HlsPlayerProps extends StormcloudVideoPlayerConfig {
5
5
  onMount?: (player: any) => void;
@@ -621,6 +621,7 @@ function createHlsAdPlayer(contentVideo, options) {
621
621
  var AD_CONTAINER_PROP = "__stormcloudAdContainer";
622
622
  var AD_VIDEO_PROP = "__stormcloudAdVideo";
623
623
  var FRAME_COUNTER_RELIABLE_PROP = "__stormcloudFrameCounterReliable";
624
+ var RVFC_RELIABLE_PROP = "__stormcloudRvfcReliable";
624
625
  var adVideoElement = (_contentVideo_AD_VIDEO_PROP = contentVideo[AD_VIDEO_PROP]) !== null && _contentVideo_AD_VIDEO_PROP !== void 0 ? _contentVideo_AD_VIDEO_PROP : void 0;
625
626
  var adHls;
626
627
  var adContainerEl = (_contentVideo_AD_CONTAINER_PROP = contentVideo[AD_CONTAINER_PROP]) !== null && _contentVideo_AD_CONTAINER_PROP !== void 0 ? _contentVideo_AD_CONTAINER_PROP : void 0;
@@ -1622,6 +1623,12 @@ function createHlsAdPlayer(contentVideo, options) {
1622
1623
  function markFrameCounterReliable() {
1623
1624
  contentVideo[FRAME_COUNTER_RELIABLE_PROP] = true;
1624
1625
  }
1626
+ function isRvfcReliable() {
1627
+ return contentVideo[RVFC_RELIABLE_PROP] === true;
1628
+ }
1629
+ function markRvfcReliable() {
1630
+ contentVideo[RVFC_RELIABLE_PROP] = true;
1631
+ }
1625
1632
  function cancelVideoFrameProbe() {
1626
1633
  if (videoFrameCallbackHandle != null && adVideoElement && typeof adVideoElement.cancelVideoFrameCallback === "function") {
1627
1634
  try {
@@ -1641,6 +1648,7 @@ function createHlsAdPlayer(contentVideo, options) {
1641
1648
  videoFrameCallbackHandle = void 0;
1642
1649
  if (!adPlaying) return;
1643
1650
  sawDecodedVideoFrame = true;
1651
+ markRvfcReliable();
1644
1652
  };
1645
1653
  try {
1646
1654
  videoFrameCallbackHandle = rvfc.call(adVideoElement, onPresentedFrame);
@@ -1665,18 +1673,19 @@ function createHlsAdPlayer(contentVideo, options) {
1665
1673
  noteAdProgress();
1666
1674
  sawDecodedVideoFrame = false;
1667
1675
  startVideoFrameProbe();
1676
+ var blackFrameDetectionEnabled = !requiresMediaPipelineResetAfterAds();
1668
1677
  stallWatchdogId = window.setInterval(function() {
1669
1678
  if (!adPlaying || !adVideoElement) {
1670
1679
  return;
1671
1680
  }
1672
- if (!sawDecodedVideoFrame && !adVideoElement.paused) {
1681
+ if (blackFrameDetectionEnabled && !sawDecodedVideoFrame && !adVideoElement.paused) {
1673
1682
  var decodedFrames = getDecodedVideoFrameCount(adVideoElement);
1674
1683
  if (decodedFrames !== void 0 && decodedFrames > 0) {
1675
1684
  sawDecodedVideoFrame = true;
1676
1685
  markFrameCounterReliable();
1677
1686
  } else if (adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S) {
1678
1687
  var timeAdvancing = adVideoElement.currentTime > lastAdProgressPosition + 0.05;
1679
- if (isRvfcSupported(adVideoElement) && timeAdvancing) {
1688
+ if (isRvfcSupported(adVideoElement) && timeAdvancing && isRvfcReliable()) {
1680
1689
  handleVideoDecodeFailure();
1681
1690
  return;
1682
1691
  }
@@ -2077,7 +2086,7 @@ function createHlsAdPlayer(contentVideo, options) {
2077
2086
  }
2078
2087
  },
2079
2088
  hidePlaceholder: function hidePlaceholder() {
2080
- if (adContainerEl) {
2089
+ if (adContainerEl && !adPlaying) {
2081
2090
  adContainerEl.style.display = "none";
2082
2091
  adContainerEl.style.pointerEvents = "none";
2083
2092
  }