Anthony watchman integration #6799
2 changed files with 9 additions and 23 deletions
|
@ -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,
|
||||
|
||||
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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue
This sort of thing, if tested elsewhere should use a constant, make a new file in constants if necessary.