stormcloud-video-player 0.8.53 → 0.8.55

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.
Files changed (70) hide show
  1. package/dist/stormcloud-vp.min.js +1 -1
  2. package/lib/index.cjs +204 -110
  3. package/lib/index.cjs.map +1 -1
  4. package/lib/index.d.cts +2 -0
  5. package/lib/index.d.ts +2 -0
  6. package/lib/index.js +204 -110
  7. package/lib/index.js.map +1 -1
  8. package/lib/player/AdBreakOrchestrator.cjs +69 -66
  9. package/lib/player/AdBreakOrchestrator.cjs.map +1 -1
  10. package/lib/player/AdBreakOrchestrator.d.cts +1 -1
  11. package/lib/player/AdConfigManager.cjs +38 -33
  12. package/lib/player/AdConfigManager.cjs.map +1 -1
  13. package/lib/player/AdConfigManager.d.cts +1 -1
  14. package/lib/player/AdTimingService.cjs +18 -25
  15. package/lib/player/AdTimingService.cjs.map +1 -1
  16. package/lib/player/AdTimingService.d.cts +1 -1
  17. package/lib/player/HlsEngine.cjs +86 -30
  18. package/lib/player/HlsEngine.cjs.map +1 -1
  19. package/lib/player/HlsEngine.d.cts +6 -1
  20. package/lib/player/PlaceholderLayer.cjs +1 -3
  21. package/lib/player/PlaceholderLayer.cjs.map +1 -1
  22. package/lib/player/PlayerControls.cjs.map +1 -1
  23. package/lib/player/PlayerControls.d.cts +1 -1
  24. package/lib/player/Scte35CueManager.cjs +2 -4
  25. package/lib/player/Scte35CueManager.cjs.map +1 -1
  26. package/lib/player/Scte35CueManager.d.cts +1 -1
  27. package/lib/player/Scte35Parser.cjs +6 -12
  28. package/lib/player/Scte35Parser.cjs.map +1 -1
  29. package/lib/player/Scte35Parser.d.cts +1 -1
  30. package/lib/player/StormcloudVideoPlayer.cjs +194 -96
  31. package/lib/player/StormcloudVideoPlayer.cjs.map +1 -1
  32. package/lib/player/StormcloudVideoPlayer.d.cts +2 -1
  33. package/lib/player/playerTypes.cjs.map +1 -1
  34. package/lib/player/playerTypes.d.cts +1 -1
  35. package/lib/players/FilePlayer.cjs +17 -26
  36. package/lib/players/FilePlayer.cjs.map +1 -1
  37. package/lib/players/HlsPlayer.cjs +204 -110
  38. package/lib/players/HlsPlayer.cjs.map +1 -1
  39. package/lib/players/HlsPlayer.d.cts +1 -1
  40. package/lib/players/index.cjs +204 -110
  41. package/lib/players/index.cjs.map +1 -1
  42. package/lib/sdk/hlsAdPlayer.cjs +42 -19
  43. package/lib/sdk/hlsAdPlayer.cjs.map +1 -1
  44. package/lib/sdk/hlsAdPlayer.d.cts +1 -1
  45. package/lib/sdk/pal.cjs +6 -9
  46. package/lib/sdk/pal.cjs.map +1 -1
  47. package/lib/{types-cTqIKw_D.d.cts → types-DpbgEvSH.d.cts} +1 -0
  48. package/lib/ui/StormcloudVideoPlayer.cjs +194 -96
  49. package/lib/ui/StormcloudVideoPlayer.cjs.map +1 -1
  50. package/lib/ui/StormcloudVideoPlayer.d.cts +1 -1
  51. package/lib/utils/browserCompat.cjs +3 -6
  52. package/lib/utils/browserCompat.cjs.map +1 -1
  53. package/lib/utils/ctvVastSignals.cjs +3 -6
  54. package/lib/utils/ctvVastSignals.cjs.map +1 -1
  55. package/lib/utils/devUrl.cjs.map +1 -1
  56. package/lib/utils/mqttClient.cjs +1 -3
  57. package/lib/utils/mqttClient.cjs.map +1 -1
  58. package/lib/utils/mqttConfig.cjs +1 -3
  59. package/lib/utils/mqttConfig.cjs.map +1 -1
  60. package/lib/utils/polyfills.cjs +4 -7
  61. package/lib/utils/polyfills.cjs.map +1 -1
  62. package/lib/utils/tracking.cjs +27 -20
  63. package/lib/utils/tracking.cjs.map +1 -1
  64. package/lib/utils/tracking.d.cts +1 -1
  65. package/lib/utils/vastEnvironmentSignals.cjs +7 -6
  66. package/lib/utils/vastEnvironmentSignals.cjs.map +1 -1
  67. package/lib/utils/vastEnvironmentSignals.d.cts +2 -1
  68. package/lib/utils/vastMacros.cjs +4 -2
  69. package/lib/utils/vastMacros.cjs.map +1 -1
  70. package/package.json +1 -1
@@ -7,11 +7,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
7
7
  reject(error);
8
8
  return;
9
9
  }
10
- if (info.done) {
11
- resolve(value);
12
- } else {
13
- Promise.resolve(value).then(_next, _throw);
14
- }
10
+ if (info.done) resolve(value);
11
+ else Promise.resolve(value).then(_next, _throw);
15
12
  }
16
13
  function _async_to_generator(fn) {
17
14
  return function() {
@@ -28,10 +25,6 @@ function _async_to_generator(fn) {
28
25
  });
29
26
  };
30
27
  }
31
- function _type_of(obj) {
32
- "@swc/helpers - typeof";
33
- return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
34
- }
35
28
  function _ts_generator(thisArg, body) {
36
29
  var f, y, t, _ = {
37
30
  label: 0,
@@ -131,6 +124,10 @@ function _ts_generator(thisArg, body) {
131
124
  };
132
125
  }
133
126
  }
127
+ function _type_of(obj) {
128
+ "@swc/helpers - typeof";
129
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
130
+ }
134
131
  var __create = Object.create;
135
132
  var __defProp = Object.defineProperty;
136
133
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -360,6 +357,7 @@ function createHlsAdPlayer(contentVideo, options) {
360
357
  var adContainerEl = (_contentVideo_AD_CONTAINER_PROP = contentVideo[AD_CONTAINER_PROP]) !== null && _contentVideo_AD_CONTAINER_PROP !== void 0 ? _contentVideo_AD_CONTAINER_PROP : void 0;
361
358
  var adEventHandlers = [];
362
359
  var currentAd;
360
+ var currentAdMediaUrl;
363
361
  var podAds = [];
364
362
  var podIndex = 0;
365
363
  var sessionId;
@@ -1177,9 +1175,9 @@ function createHlsAdPlayer(contentVideo, options) {
1177
1175
  delete contentVideo.dataset.stormcloudAdPlaying;
1178
1176
  }
1179
1177
  }
1180
- function resetQuartileTracking(preserveImpression) {
1178
+ function resetQuartileTracking() {
1181
1179
  trackingFired = {
1182
- impression: preserveImpression ? trackingFired.impression : false,
1180
+ impression: false,
1183
1181
  start: false,
1184
1182
  firstQuartile: false,
1185
1183
  midpoint: false,
@@ -1187,6 +1185,27 @@ function createHlsAdPlayer(contentVideo, options) {
1187
1185
  complete: false
1188
1186
  };
1189
1187
  }
1188
+ function markCreativeRendered(reason) {
1189
+ if (!currentAd || trackingFired.impression) return;
1190
+ trackingFired.impression = true;
1191
+ fireTrackingPixels(currentAd.trackingUrls.impression);
1192
+ console.log("[HlsAdPlayer] Impression (pod ".concat(podIndex + 1, "/").concat(podAds.length || 1, ", reason: ").concat(reason, "): ").concat(currentAd.title));
1193
+ emit("ad_impression", {
1194
+ adId: currentAd.id,
1195
+ title: currentAd.title,
1196
+ durationSeconds: currentAd.duration,
1197
+ mediaUrl: currentAdMediaUrl,
1198
+ podIndex: podIndex,
1199
+ podSize: podAds.length || 1,
1200
+ reason: reason
1201
+ });
1202
+ }
1203
+ function canDetectBlackFrames() {
1204
+ if (!adVideoElement) return false;
1205
+ if (requiresMediaPipelineResetAfterAds()) return false;
1206
+ if (isRvfcSupported(adVideoElement)) return true;
1207
+ return getDecodedVideoFrameCount(adVideoElement) !== void 0;
1208
+ }
1190
1209
  function isRvfcSupported(video) {
1191
1210
  return typeof video.requestVideoFrameCallback === "function";
1192
1211
  }
@@ -1249,6 +1268,7 @@ function createHlsAdPlayer(contentVideo, options) {
1249
1268
  if (!mediaFile) {
1250
1269
  throw new Error("No media file available for ad");
1251
1270
  }
1271
+ currentAdMediaUrl = mediaFile.url;
1252
1272
  var isHlsAd = isHlsMediaFile(mediaFile);
1253
1273
  console.log("[HlsAdPlayer] Loading ".concat(isHlsAd ? "HLS" : "progressive", " ad (pod ").concat(podIndex + 1, "/").concat(podAds.length || 1, ") from: ").concat(mediaFile.url));
1254
1274
  if (isHlsAd && import_hls.default.isSupported()) {
@@ -1292,10 +1312,9 @@ function createHlsAdPlayer(contentVideo, options) {
1292
1312
  }
1293
1313
  podIndex++;
1294
1314
  currentAd = podAds[podIndex];
1295
- resetQuartileTracking(false);
1315
+ currentAdMediaUrl = void 0;
1316
+ resetQuartileTracking();
1296
1317
  if (currentAd) {
1297
- fireTrackingPixels(currentAd.trackingUrls.impression);
1298
- trackingFired.impression = true;
1299
1318
  console.log("[HlsAdPlayer] Advancing to next pod ad (".concat(podIndex + 1, "/").concat(podAds.length, "): ").concat(currentAd.title, ", duration: ").concat(currentAd.duration, "s"));
1300
1319
  }
1301
1320
  clearStallWatchdog();
@@ -1390,6 +1409,7 @@ function createHlsAdPlayer(contentVideo, options) {
1390
1409
  if (!adPlaying) return;
1391
1410
  sawDecodedVideoFrame = true;
1392
1411
  markRvfcReliable();
1412
+ markCreativeRendered("first_presented_frame");
1393
1413
  };
1394
1414
  try {
1395
1415
  videoFrameCallbackHandle = rvfc.call(adVideoElement, onPresentedFrame);
@@ -1424,6 +1444,7 @@ function createHlsAdPlayer(contentVideo, options) {
1424
1444
  if (decodedFrames !== void 0 && decodedFrames > 0) {
1425
1445
  sawDecodedVideoFrame = true;
1426
1446
  markFrameCounterReliable();
1447
+ markCreativeRendered("decoded_frames");
1427
1448
  } else if (adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S) {
1428
1449
  var timeAdvancing = adVideoElement.currentTime > lastAdProgressPosition + 0.05;
1429
1450
  if (isRvfcSupported(adVideoElement) && timeAdvancing && isRvfcReliable()) {
@@ -1436,6 +1457,9 @@ function createHlsAdPlayer(contentVideo, options) {
1436
1457
  }
1437
1458
  }
1438
1459
  }
1460
+ if (!trackingFired.impression && !adVideoElement.paused && adVideoElement.currentTime >= BLACKFRAME_MIN_PLAYBACK_S && (sawDecodedVideoFrame || !canDetectBlackFrames())) {
1461
+ markCreativeRendered(sawDecodedVideoFrame ? "decoded_frames" : "sustained_playback");
1462
+ }
1439
1463
  if (adVideoElement.currentTime > lastAdProgressPosition + 0.05) {
1440
1464
  noteAdProgress();
1441
1465
  return;
@@ -1574,11 +1598,9 @@ function createHlsAdPlayer(contentVideo, options) {
1574
1598
  podAds = ads;
1575
1599
  podIndex = 0;
1576
1600
  currentAd = ads[0];
1601
+ currentAdMediaUrl = void 0;
1602
+ resetQuartileTracking();
1577
1603
  console.log("[HlsAdPlayer] Pod parsed: ".concat(ads.length, ' ad(s), first="').concat(currentAd === null || currentAd === void 0 ? void 0 : currentAd.title, '", duration=').concat(currentAd === null || currentAd === void 0 ? void 0 : currentAd.duration, "s"));
1578
- if (currentAd) {
1579
- fireTrackingPixels(currentAd.trackingUrls.impression);
1580
- trackingFired.impression = true;
1581
- }
1582
1604
  return [
1583
1605
  2,
1584
1606
  Promise.resolve()
@@ -1618,7 +1640,7 @@ function createHlsAdPlayer(contentVideo, options) {
1618
1640
  contentVideo[AD_VIDEO_PROP] = adVideoElement;
1619
1641
  }
1620
1642
  setupAdEventListeners();
1621
- resetQuartileTracking(true);
1643
+ resetQuartileTracking();
1622
1644
  contentVolume = contentVideo.volume;
1623
1645
  originalVolume = Math.max(0, Math.min(1, contentVolume || originalVolume));
1624
1646
  if (!(options === null || options === void 0 ? void 0 : options.continueLiveStreamDuringAds)) {
@@ -1708,6 +1730,7 @@ function createHlsAdPlayer(contentVideo, options) {
1708
1730
  }
1709
1731
  }
1710
1732
  currentAd = void 0;
1733
+ currentAdMediaUrl = void 0;
1711
1734
  podAds = [];
1712
1735
  podIndex = 0;
1713
1736
  return [