Anthony watchman integration #6799

Merged
mayeaux merged 20 commits from anthony-watchman-integration into master 2021-08-10 22:42:50 +02:00
2 changed files with 11 additions and 5 deletions
Showing only changes of commit 3699b22ad6 - Show all commits

View file

@ -139,7 +139,7 @@ async function sendAndResetWatchmanData(){
duration: Math.round(durationInSeconds) * 1000,
protocol,
player: playerPoweredBy,
user_id: Number(userId),
user_id: userId.toString(),
position: Math.round(timeAtBuffer) ,
rel_position: Math.round((timeAtBuffer / (totalDurationInSeconds * 1000)) * 100),
};
@ -198,8 +198,13 @@ const analytics: Analytics = {
stopWatchmanInterval();
// TODO: clear data here
},
videoIsPlaying: () => {
startWatchmanIntervalIfNotRunning();
videoIsPlaying: (isPlaying) => {
if(isPlaying){
startWatchmanIntervalIfNotRunning();
} else {
stopWatchmanInterval();
}
},
error: (message) => {
return new Promise((resolve) => {
@ -320,8 +325,9 @@ const analytics: Analytics = {
}
},
videoStartEvent: (claimId, duration, poweredBy, canonicalUrl, playerFromView, passedUserId) => {
videoStartEvent: (claimId, duration, poweredBy, passedUserId, canonicalUrl, playerFromView) => {
console.log('Video start');
userId = passedUserId
passedPlayer = playerFromView

View file

@ -156,7 +156,7 @@ function VideoViewer(props: Props) {
fetch(source, { method: 'HEAD' }).then((response) => {
var playerPoweredBy = response.headers.get('x-powered-by');
analytics.videoStartEvent(claimId, timeToStart, playerPoweredBy, claim && claim.canonical_url, player, userId);
analytics.videoStartEvent(claimId, timeToStart, playerPoweredBy, userId, claim && claim.canonical_url, player);
});
doAnalyticsView(uri, timeToStart).then(() => {