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 9 additions and 23 deletions
Showing only changes of commit 5b2c808f78 - Show all commits

View file

@ -103,14 +103,11 @@ console.log('ANALYTICS RELOADED');
var durationInSeconds = 10;
var amountOfBufferEvents = 0;
var amountOfBufferTimeInMS = 0;
var videoType, userId, claimUrl, totalDurationInSeconds, currentVideoPosition, playerPoweredBy, timeAtBuffer;
var videoType, userId, claimUrl, currentVideoPosition, playerPoweredBy, timeAtBuffer;
async function sendAndResetWatchmanData(){
// console.log('running!')
// console.log(player);
var protocol;
if (videoType === 'application/x-mpegURL'){
protocol = 'hls';
@ -118,36 +115,27 @@ async function sendAndResetWatchmanData(){
protocol = 'stb';
}
if(!totalDurationInSeconds){
totalDurationInSeconds = player.currentTime();
if(!timeAtBuffer){
timeAtBuffer = Math.round(player.currentTime()) * 1000;
}
if(!timeAtBuffer){
timeAtBuffer = player.duration();
}
//
// console.log('time at buffer');
// console.log(timeAtBuffer);
// console.log(totalDurationInSeconds);
var totalDurationInSeconds = Math.round(player.duration());
const objectToSend = {
rebuf_count: amountOfBufferEvents,
rebuf_duration: amountOfBufferTimeInMS,
url: claimUrl,
jessopb commented 2021-08-09 23:09:01 +02:00 (Migrated from github.com)
Review

This sort of thing, if tested elsewhere should use a constant, make a new file in constants if necessary.

This sort of thing, if tested elsewhere should use a constant, make a new file in constants if necessary.
device: getDeviceType(),
duration: durationInSeconds * 1000,
duration: Math.round(durationInSeconds) * 1000,
protocol,
player: playerPoweredBy,
user_id: Number(userId),
position: Math.round(timeAtBuffer) ,
rel_position: Math.round((timeAtBuffer / (totalDurationInSeconds * 1000)) * 100),
}
console.log('About to send the data!');
};
await sendWatchmanData(objectToSend);
// TODO: send here
amountOfBufferEvents = 0;
amountOfBufferTimeInMS = 0;
timeAtBuffer = null;
@ -195,8 +183,6 @@ const analytics: Analytics = {
timeAtBuffer = data.timeAtBuffer;
totalDurationInSeconds = data.duration;
// console.log('RUNNING HERE');
//
// console.log(claim);

View file

@ -127,9 +127,9 @@ function VideoViewer(props: Props) {
}, [embedded, videoPlaybackRate]);
function doTrackingBuffered(e: Event, data: any) {
console.log('BUFFER');
console.log(this);
console.log('BUFFER');
// console.log('BUFFER');
// console.log(this);
// console.log('BUFFER');
// this.pause()
//
// doAnalyticsBuffer(uri, data);