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,4 +1,4 @@
1
- import { A as AdController } from '../types-iDjS8f_7.cjs';
1
+ import { A as AdController } from '../types-cTqIKw_D.cjs';
2
2
  import Hls from 'hls.js';
3
3
 
4
4
  declare function createHlsAdPlayer(contentVideo: HTMLVideoElement, options?: {
@@ -571,6 +571,7 @@ function createHlsAdPlayer(contentVideo, options) {
571
571
  var AD_CONTAINER_PROP = "__stormcloudAdContainer";
572
572
  var AD_VIDEO_PROP = "__stormcloudAdVideo";
573
573
  var FRAME_COUNTER_RELIABLE_PROP = "__stormcloudFrameCounterReliable";
574
+ var RVFC_RELIABLE_PROP = "__stormcloudRvfcReliable";
574
575
  var adVideoElement = (_contentVideo_AD_VIDEO_PROP = contentVideo[AD_VIDEO_PROP]) !== null && _contentVideo_AD_VIDEO_PROP !== void 0 ? _contentVideo_AD_VIDEO_PROP : void 0;
575
576
  var adHls;
576
577
  var adContainerEl = (_contentVideo_AD_CONTAINER_PROP = contentVideo[AD_CONTAINER_PROP]) !== null && _contentVideo_AD_CONTAINER_PROP !== void 0 ? _contentVideo_AD_CONTAINER_PROP : void 0;
@@ -1572,6 +1573,12 @@ function createHlsAdPlayer(contentVideo, options) {
1572
1573
  function markFrameCounterReliable() {
1573
1574
  contentVideo[FRAME_COUNTER_RELIABLE_PROP] = true;
1574
1575
  }
1576
+ function isRvfcReliable() {
1577
+ return contentVideo[RVFC_RELIABLE_PROP] === true;
1578
+ }
1579
+ function markRvfcReliable() {
1580
+ contentVideo[RVFC_RELIABLE_PROP] = true;
1581
+ }
1575
1582
  function cancelVideoFrameProbe() {
1576
1583
  if (videoFrameCallbackHandle != null && adVideoElement && typeof adVideoElement.cancelVideoFrameCallback === "function") {
1577
1584
  try {
@@ -1591,6 +1598,7 @@ function createHlsAdPlayer(contentVideo, options) {
1591
1598
  videoFrameCallbackHandle = void 0;
1592
1599
  if (!adPlaying) return;
1593
1600
  sawDecodedVideoFrame = true;
1601
+ markRvfcReliable();
1594
1602
  };
1595
1603
  try {
1596
1604
  videoFrameCallbackHandle = rvfc.call(adVideoElement, onPresentedFrame);
@@ -1615,18 +1623,19 @@ function createHlsAdPlayer(contentVideo, options) {
1615
1623
  noteAdProgress();
1616
1624
  sawDecodedVideoFrame = false;
1617
1625
  startVideoFrameProbe();
1626
+ var blackFrameDetectionEnabled = !requiresMediaPipelineResetAfterAds();
1618
1627
  stallWatchdogId = window.setInterval(function() {
1619
1628
  if (!adPlaying || !adVideoElement) {
1620
1629
  return;
1621
1630
  }
1622
- if (!sawDecodedVideoFrame && !adVideoElement.paused) {
1631
+ if (blackFrameDetectionEnabled && !sawDecodedVideoFrame && !adVideoElement.paused) {
1623
1632
  var decodedFrames = getDecodedVideoFrameCount(adVideoElement);
1624
1633
  if (decodedFrames !== void 0 && decodedFrames > 0) {
1625
1634
  sawDecodedVideoFrame = true;
1626
1635
  markFrameCounterReliable();
1627
1636
  } else if (adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S) {
1628
1637
  var timeAdvancing = adVideoElement.currentTime > lastAdProgressPosition + 0.05;
1629
- if (isRvfcSupported(adVideoElement) && timeAdvancing) {
1638
+ if (isRvfcSupported(adVideoElement) && timeAdvancing && isRvfcReliable()) {
1630
1639
  handleVideoDecodeFailure();
1631
1640
  return;
1632
1641
  }
@@ -2027,7 +2036,7 @@ function createHlsAdPlayer(contentVideo, options) {
2027
2036
  }
2028
2037
  },
2029
2038
  hidePlaceholder: function hidePlaceholder() {
2030
- if (adContainerEl) {
2039
+ if (adContainerEl && !adPlaying) {
2031
2040
  adContainerEl.style.display = "none";
2032
2041
  adContainerEl.style.pointerEvents = "none";
2033
2042
  }