Recsys: fix resumed-send missing totalPlayTime
Ticket: 1751 ## Issue The `totalPlayTime` resides in the videojs plugin and is only sent to the recsys object in `onPlayerDispose`, so it missed the redux rehydration in the browser close/refresh scenario. ## Change Update the recsys value for `totalPlayTime` immediately so that it'll be part of the redux stashing (and later, rehydration). Note that recsys data is currently being saved to redux in a 15s interval. Will change that in the next commit.
This commit is contained in:
parent
6b3e03cca4
commit
8aa831fe49
3 changed files with 9 additions and 0 deletions
|
@ -156,6 +156,13 @@ const recsys: Recsys = {
|
||||||
recsys.log('createRecsysEntry', claimId);
|
recsys.log('createRecsysEntry', claimId);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateRecsysEntry: function (claimId, key, value) {
|
||||||
|
const entry = recsys.entries[claimId];
|
||||||
|
if (entry) {
|
||||||
|
entry[key] = value;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Send event for claimId
|
* Send event for claimId
|
||||||
* @param claimId
|
* @param claimId
|
||||||
|
|
1
flow-typed/recsys.js
vendored
1
flow-typed/recsys.js
vendored
|
@ -6,6 +6,7 @@ declare type Recsys = {
|
||||||
onClickedRecommended: (parentClaimId: ClaimId, newClaimId: ClaimId) => void,
|
onClickedRecommended: (parentClaimId: ClaimId, newClaimId: ClaimId) => void,
|
||||||
onRecsLoaded: (claimId: ClaimId, uris: Array<string>, uuid: string) => void,
|
onRecsLoaded: (claimId: ClaimId, uris: Array<string>, uuid: string) => void,
|
||||||
createRecsysEntry: (claimId: ClaimId, parentUuid?: ?string, uuid?: string) => void,
|
createRecsysEntry: (claimId: ClaimId, parentUuid?: ?string, uuid?: string) => void,
|
||||||
|
updateRecsysEntry: (claimId: ClaimId, key: string, value: string) => void,
|
||||||
sendRecsysEntry: (claimId: ClaimId, isTentative?: boolean) => ?Promise<?Response>,
|
sendRecsysEntry: (claimId: ClaimId, isTentative?: boolean) => ?Promise<?Response>,
|
||||||
sendEntries: (entries: ?{ [ClaimId]: RecsysEntry }, isResumedSend: boolean) => void,
|
sendEntries: (entries: ?{ [ClaimId]: RecsysEntry }, isResumedSend: boolean) => void,
|
||||||
onRecsysPlayerEvent: (claimId: ClaimId, event: RecsysPlaybackEvent, isEmbedded: boolean) => void,
|
onRecsysPlayerEvent: (claimId: ClaimId, event: RecsysPlaybackEvent, isEmbedded: boolean) => void,
|
||||||
|
|
|
@ -129,6 +129,7 @@ class RecsysPlugin extends Component {
|
||||||
if (this.watchedDuration.lastTimestamp !== curTimeSec && !this.inPause) {
|
if (this.watchedDuration.lastTimestamp !== curTimeSec && !this.inPause) {
|
||||||
this.watchedDuration.total += 1;
|
this.watchedDuration.total += 1;
|
||||||
this.watchedDuration.lastTimestamp = curTimeSec;
|
this.watchedDuration.lastTimestamp = curTimeSec;
|
||||||
|
RecSys.updateRecsysEntry(this.options_.videoId, 'totalPlayTime', this.watchedDuration.total);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue