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.
@@ -354,6 +354,7 @@ function createHlsAdPlayer(contentVideo, options) {
354
354
  var AD_CONTAINER_PROP = "__stormcloudAdContainer";
355
355
  var AD_VIDEO_PROP = "__stormcloudAdVideo";
356
356
  var FRAME_COUNTER_RELIABLE_PROP = "__stormcloudFrameCounterReliable";
357
+ var RVFC_RELIABLE_PROP = "__stormcloudRvfcReliable";
357
358
  var adVideoElement = (_contentVideo_AD_VIDEO_PROP = contentVideo[AD_VIDEO_PROP]) !== null && _contentVideo_AD_VIDEO_PROP !== void 0 ? _contentVideo_AD_VIDEO_PROP : void 0;
358
359
  var adHls;
359
360
  var adContainerEl = (_contentVideo_AD_CONTAINER_PROP = contentVideo[AD_CONTAINER_PROP]) !== null && _contentVideo_AD_CONTAINER_PROP !== void 0 ? _contentVideo_AD_CONTAINER_PROP : void 0;
@@ -1355,6 +1356,12 @@ function createHlsAdPlayer(contentVideo, options) {
1355
1356
  function markFrameCounterReliable() {
1356
1357
  contentVideo[FRAME_COUNTER_RELIABLE_PROP] = true;
1357
1358
  }
1359
+ function isRvfcReliable() {
1360
+ return contentVideo[RVFC_RELIABLE_PROP] === true;
1361
+ }
1362
+ function markRvfcReliable() {
1363
+ contentVideo[RVFC_RELIABLE_PROP] = true;
1364
+ }
1358
1365
  function cancelVideoFrameProbe() {
1359
1366
  if (videoFrameCallbackHandle != null && adVideoElement && typeof adVideoElement.cancelVideoFrameCallback === "function") {
1360
1367
  try {
@@ -1374,6 +1381,7 @@ function createHlsAdPlayer(contentVideo, options) {
1374
1381
  videoFrameCallbackHandle = void 0;
1375
1382
  if (!adPlaying) return;
1376
1383
  sawDecodedVideoFrame = true;
1384
+ markRvfcReliable();
1377
1385
  };
1378
1386
  try {
1379
1387
  videoFrameCallbackHandle = rvfc.call(adVideoElement, onPresentedFrame);
@@ -1398,18 +1406,19 @@ function createHlsAdPlayer(contentVideo, options) {
1398
1406
  noteAdProgress();
1399
1407
  sawDecodedVideoFrame = false;
1400
1408
  startVideoFrameProbe();
1409
+ var blackFrameDetectionEnabled = !requiresMediaPipelineResetAfterAds();
1401
1410
  stallWatchdogId = window.setInterval(function() {
1402
1411
  if (!adPlaying || !adVideoElement) {
1403
1412
  return;
1404
1413
  }
1405
- if (!sawDecodedVideoFrame && !adVideoElement.paused) {
1414
+ if (blackFrameDetectionEnabled && !sawDecodedVideoFrame && !adVideoElement.paused) {
1406
1415
  var decodedFrames = getDecodedVideoFrameCount(adVideoElement);
1407
1416
  if (decodedFrames !== void 0 && decodedFrames > 0) {
1408
1417
  sawDecodedVideoFrame = true;
1409
1418
  markFrameCounterReliable();
1410
1419
  } else if (adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S) {
1411
1420
  var timeAdvancing = adVideoElement.currentTime > lastAdProgressPosition + 0.05;
1412
- if (isRvfcSupported(adVideoElement) && timeAdvancing) {
1421
+ if (isRvfcSupported(adVideoElement) && timeAdvancing && isRvfcReliable()) {
1413
1422
  handleVideoDecodeFailure();
1414
1423
  return;
1415
1424
  }
@@ -1810,7 +1819,7 @@ function createHlsAdPlayer(contentVideo, options) {
1810
1819
  }
1811
1820
  },
1812
1821
  hidePlaceholder: function hidePlaceholder() {
1813
- if (adContainerEl) {
1822
+ if (adContainerEl && !adPlaying) {
1814
1823
  adContainerEl.style.display = "none";
1815
1824
  adContainerEl.style.pointerEvents = "none";
1816
1825
  }