recsys take 99
This commit is contained in:
parent
ffcf09efd0
commit
fd1ee4f43c
2 changed files with 14 additions and 2 deletions
|
@ -43,6 +43,7 @@ const recsys = {
|
||||||
* - pageLoadedAt
|
* - pageLoadedAt
|
||||||
* - isEmbed
|
* - isEmbed
|
||||||
* - pageExitedAt
|
* - pageExitedAt
|
||||||
|
* - autoplay
|
||||||
* - recsysId // optional
|
* - recsysId // optional
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -152,6 +153,16 @@ const recsys = {
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
onRecsysPlayerEvent: function (claimId, event, isEmbedded) {
|
onRecsysPlayerEvent: function (claimId, event, isEmbedded) {
|
||||||
|
const state = window.store.getState();
|
||||||
|
const autoPlayNext = state && selectClientSetting(state, SETTINGS.AUTOPLAY_NEXT);
|
||||||
|
// Check if played through (4 = onEnded) and handle multiple events at end
|
||||||
|
if (recsys.entries[claimId] && !recsys.entries[claimId]['autoplay'] === true) {
|
||||||
|
if (autoPlayNext && event.event === 4) {
|
||||||
|
recsys.entries[claimId]['autoplay'] = true;
|
||||||
|
} else {
|
||||||
|
recsys.entries[claimId]['autoplay'] = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!recsys.entries[claimId]) {
|
if (!recsys.entries[claimId]) {
|
||||||
recsys.createRecsysEntry(claimId);
|
recsys.createRecsysEntry(claimId);
|
||||||
// do something to show it's floating or autoplay
|
// do something to show it's floating or autoplay
|
||||||
|
@ -235,7 +246,7 @@ const recsys = {
|
||||||
const shouldSkip = recsys.entries[claimId].parentUuid && !recsys.entries[claimId].recClaimIds;
|
const shouldSkip = recsys.entries[claimId].parentUuid && !recsys.entries[claimId].recClaimIds;
|
||||||
if (!shouldSkip && ((claimId !== playingClaimId && floatingPlayer) || !floatingPlayer)) {
|
if (!shouldSkip && ((claimId !== playingClaimId && floatingPlayer) || !floatingPlayer)) {
|
||||||
recsys.entries[claimId]['pageExitedAt'] = Date.now();
|
recsys.entries[claimId]['pageExitedAt'] = Date.now();
|
||||||
recsys.sendRecsysEntry(claimId);
|
// recsys.sendRecsysEntry(claimId); breaks pop out = off, not helping with browser close.
|
||||||
}
|
}
|
||||||
recsys.log('OnNavigate', claimId);
|
recsys.log('OnNavigate', claimId);
|
||||||
});
|
});
|
||||||
|
|
|
@ -11,6 +11,7 @@ const PlayerEvent = {
|
||||||
stop: 1,
|
stop: 1,
|
||||||
scrub: 2,
|
scrub: 2,
|
||||||
speed: 3,
|
speed: 3,
|
||||||
|
ended: 4,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -86,7 +87,7 @@ class RecsysPlugin extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
onEnded(event) {
|
onEnded(event) {
|
||||||
const recsysEvent = newRecsysPlayerEvent(PlayerEvent.event.stop, this.player.currentTime());
|
const recsysEvent = newRecsysPlayerEvent(PlayerEvent.event.ended, this.player.currentTime());
|
||||||
this.log('onEnded', recsysEvent);
|
this.log('onEnded', recsysEvent);
|
||||||
RecSys.onRecsysPlayerEvent(this.options_.videoId, recsysEvent);
|
RecSys.onRecsysPlayerEvent(this.options_.videoId, recsysEvent);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue