mirror of
https://github.com/LBRYFoundation/lbry-desktop.git
synced 2025-08-23 17:47:24 +00:00
add logging of player point of presence
This commit is contained in:
parent
2c22aee126
commit
fb142f7699
3 changed files with 35 additions and 24 deletions
|
@ -38,7 +38,14 @@ type Analytics = {
|
||||||
videoStartEvent: (string, number) => void,
|
videoStartEvent: (string, number) => void,
|
||||||
videoBufferEvent: (
|
videoBufferEvent: (
|
||||||
StreamClaim,
|
StreamClaim,
|
||||||
{ timeAtBuffer: number, bufferDuration: number, bitRate: number, duration: number, userIdHash: string }
|
{
|
||||||
|
timeAtBuffer: number,
|
||||||
|
bufferDuration: number,
|
||||||
|
bitRate: number,
|
||||||
|
duration: number,
|
||||||
|
userIdHash: string,
|
||||||
|
playerPoweredBy: string,
|
||||||
|
}
|
||||||
) => void,
|
) => void,
|
||||||
emailProvidedEvent: () => void,
|
emailProvidedEvent: () => void,
|
||||||
emailVerifiedEvent: () => void,
|
emailVerifiedEvent: () => void,
|
||||||
|
@ -185,13 +192,11 @@ const analytics: Analytics = {
|
||||||
sendPromMetric('time_to_start', duration);
|
sendPromMetric('time_to_start', duration);
|
||||||
sendMatomoEvent('Media', 'TimeToStart', claimId, duration);
|
sendMatomoEvent('Media', 'TimeToStart', claimId, duration);
|
||||||
},
|
},
|
||||||
videoBufferEvent: (claim, data) => {
|
|
||||||
// @if TARGET='web'
|
|
||||||
sendPromMetric('buffer');
|
|
||||||
// @endif
|
|
||||||
|
|
||||||
|
videoBufferEvent: (claim, data) => {
|
||||||
sendMatomoEvent('Media', 'BufferTimestamp', claim.claim_id, data.timeAtBuffer);
|
sendMatomoEvent('Media', 'BufferTimestamp', claim.claim_id, data.timeAtBuffer);
|
||||||
|
|
||||||
|
if (LBRY_WEB_BUFFER_API) {
|
||||||
fetch(LBRY_WEB_BUFFER_API, {
|
fetch(LBRY_WEB_BUFFER_API, {
|
||||||
method: 'post',
|
method: 'post',
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -206,11 +211,13 @@ const analytics: Analytics = {
|
||||||
url: claim.canonical_url,
|
url: claim.canonical_url,
|
||||||
position: data.timeAtBuffer,
|
position: data.timeAtBuffer,
|
||||||
duration: data.bufferDuration,
|
duration: data.bufferDuration,
|
||||||
|
player: data.playerPoweredBy,
|
||||||
stream_duration: data.duration,
|
stream_duration: data.duration,
|
||||||
stream_bitrate: data.bitRate,
|
stream_bitrate: data.bitRate,
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
tagFollowEvent: (tag, following) => {
|
tagFollowEvent: (tag, following) => {
|
||||||
sendMatomoEvent('Tag', following ? 'Tag-Follow' : 'Tag-Unfollow', tag);
|
sendMatomoEvent('Tag', following ? 'Tag-Follow' : 'Tag-Unfollow', tag);
|
||||||
|
|
|
@ -87,7 +87,10 @@ function VideoViewer(props: Props) {
|
||||||
}, [uri, previousUri]);
|
}, [uri, previousUri]);
|
||||||
|
|
||||||
function doTrackingBuffered(e: Event, data: any) {
|
function doTrackingBuffered(e: Event, data: any) {
|
||||||
|
fetch(source, { method: 'HEAD' }).then(response => {
|
||||||
|
data.playerPoweredBy = response.headers.get('x-powered-by');
|
||||||
doAnalyticsBuffer(uri, data);
|
doAnalyticsBuffer(uri, data);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function doTrackingFirstPlay(e: Event, data: any) {
|
function doTrackingFirstPlay(e: Event, data: any) {
|
||||||
|
|
|
@ -491,6 +491,7 @@ export function doAnalyticsBuffer(uri, bufferData) {
|
||||||
bitRate,
|
bitRate,
|
||||||
userIdHash,
|
userIdHash,
|
||||||
duration: fileDurationInSeconds,
|
duration: fileDurationInSeconds,
|
||||||
|
playerPoweredBy: bufferData.playerPoweredBy,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue