Skip to content

Commit

Permalink
feat: pass feedid to ott analytics for play event
Browse files Browse the repository at this point in the history
  • Loading branch information
CarinaDraganJW committed May 2, 2023
1 parent 9d1d4d9 commit 7a2bf23
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
9 changes: 5 additions & 4 deletions public/jwpltx.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ window.jwpltx = window.jwpltx || {};
});

// Process a time tick event
o.time = function (vp, vd) {
o.time = function (vp, vd, fed) {
if (isSeeking) {
return;
}
Expand All @@ -153,7 +153,7 @@ window.jwpltx = window.jwpltx || {};

sendData('s');
setLiveInterval();
// monitor ticks for 20s elapsed
// Monitor ticks for 20s elapsed
} else {
if (timeWatched > 19) {
uri.ti = timeWatched;
Expand All @@ -162,7 +162,7 @@ window.jwpltx = window.jwpltx || {};
}
}

// positive vd means VOD stream
// Positive vd means VOD stream
} else {
// Initial tick means play() event
if (!uri.vd) {
Expand All @@ -181,14 +181,15 @@ window.jwpltx = window.jwpltx || {};

uri.ti = 0;
uri.pw = 0;
uri.fed = fed;

// Initialize latest quantile to compare further quantiles with
nextQuantile = getNextTriggerQuantile(vp, vd);
// Initial values to compare watched progress
lastVp = vp;

sendData('s');
// monitor ticks for entering new quantile
// Monitor ticks for entering new quantile
} else {
const pw = getCurrentProgressQuantile(vp, vd);
const quantile = getNextTriggerQuantile(vp, vd);
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useOttAnalytics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const useOttAnalytics = (item?: PlaylistItem, feedId: string = '') => {
const [player, setPlayer] = useState<jwplayer.JWPlayer | null>(null);

const timeHandler = useCallback(({ position, duration }: jwplayer.TimeParam) => {
window.jwpltx.time(position, duration);
window.jwpltx.time(position, duration, feedId);
}, []);

const seekHandler = useCallback(({ offset, duration }) => {
Expand Down
2 changes: 1 addition & 1 deletion types/jwpltx.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ interface Jwpltx {
adImpression: () => void;
seek: (offset: number, duration: number) => void;
seeked: () => void;
time: (position: number, duration: number) => void;
time: (position: number, duration: number, feedid?: string | null | undefined) => void;
complete: () => void;
remove: () => void;
}

0 comments on commit 7a2bf23

Please sign in to comment.