Skip to content

Commit

Permalink
Fix initialization of the HTML5 media tracking plugin so that it init…
Browse files Browse the repository at this point in the history
…ializes the parent media plugin (#1369)
  • Loading branch information
matus-tomlein committed Nov 1, 2024
1 parent cdbaf50 commit 820ff44
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@snowplow/browser-plugin-media-tracking",
"comment": "Fix initialization of the HTML5 media tracking plugin so that it initializes the parent media plugin (#1369)",
"type": "none"
}
],
"packageName": "@snowplow/browser-plugin-media-tracking"
}
9 changes: 3 additions & 6 deletions plugins/browser-plugin-media-tracking/src/api.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Logger } from '@snowplow/tracker-core';
import { BrowserPlugin, BrowserTracker } from '@snowplow/browser-tracker-core';
import { BrowserPlugin } from '@snowplow/browser-tracker-core';
import { waitForElement } from './findElem';
import { Config, isElementConfig, isStringConfig } from './config';
import { setUpListeners } from './player';
Expand All @@ -14,16 +14,13 @@ import { HTML5MediaEventTypes } from './config';
// @ts-ignore: TS6133
import { FilterOutRepeatedEvents } from '@snowplow/browser-plugin-media/src/types';

import { endMediaTracking } from '@snowplow/browser-plugin-media';
import { endMediaTracking, SnowplowMediaPlugin } from '@snowplow/browser-plugin-media';

let LOG: Logger;
const _trackers: Record<string, BrowserTracker> = {};

export function MediaTrackingPlugin(): BrowserPlugin {
return {
activateBrowserPlugin: (tracker: BrowserTracker) => {
_trackers[tracker.id] = tracker;
},
...SnowplowMediaPlugin(),
logger: (logger) => {
LOG = logger;
},
Expand Down

0 comments on commit 820ff44

Please sign in to comment.