1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-06 03:50:04 +02:00

improve beacon

This commit is contained in:
Daniel 2021-08-02 16:55:17 -03:00
parent f2e527cceb
commit 1047b16303

View file

@ -467,9 +467,17 @@ function addViewBeacon() {
beacon.src = url; beacon.src = url;
console.log('addViewBeacon will be sent', mediaId, playerCurrentTime, seconds_watching_video, beacon); console.log('addViewBeacon will be sent', mediaId, playerCurrentTime, seconds_watching_video, beacon);
_addViewBeaconAdded = true; _addViewBeaconAdded = true;
}else{ } else {
if (typeof mediaId !== 'undefined') {
console.log('addViewBeacon mediaId is undefined'); console.log('addViewBeacon mediaId is undefined');
} }
if (typeof playerCurrentTime !== 'undefined') {
console.log('addViewBeacon playerCurrentTime is undefined');
}
if (typeof seconds_watching_video !== 'undefined') {
console.log('addViewBeacon seconds_watching_video is undefined');
}
}
return ''; return '';
} }
@ -1259,7 +1267,7 @@ function checkDescriptionArea() {
}); });
} }
$(document).ready(function () { $(document).ready(function () {
window.addEventListener('beforeunload', function(e) { window.addEventListener('beforeunload', function (e) {
console.log('window.addEventListener(beforeunload'); console.log('window.addEventListener(beforeunload');
addViewBeacon(); addViewBeacon();
}, false); }, false);