@streamscloud/streams-analytics-collector 1.0.7 → 1.0.8

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.
@@ -58,9 +58,14 @@ class AppEventsTracker {
58
58
  this.videosByPage.set(pageId, new Map());
59
59
  }
60
60
  // Update the played percentage for this video on this page
61
+ // Only store the maximum percentage in case of looping videos
61
62
  const pageVideos = this.videosByPage.get(pageId);
62
63
  if (pageVideos) {
63
- pageVideos.set(`${videoId}|${streamId || ''}`, playedPercents);
64
+ const videoKey = `${videoId}|${streamId || ''}`;
65
+ const currentMaxPercent = pageVideos.get(videoKey) || 0;
66
+ // Store only the maximum played percentage value
67
+ // This ensures we don't decrease progress when video loops
68
+ pageVideos.set(videoKey, Math.max(currentMaxPercent, playedPercents));
64
69
  }
65
70
  }
66
71
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@streamscloud/streams-analytics-collector",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",