mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Make reportPlayback less spammy
This commit is contained in:
parent
9c7e5a0382
commit
bffafa6914
1 changed files with 14 additions and 1 deletions
|
@ -38,6 +38,12 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
|||
events.trigger(playbackManagerInstance, 'playerchange', [newPlayer, newTarget, previousPlayer]);
|
||||
}
|
||||
|
||||
/** Last invoked method */
|
||||
let reportPlaybackLastMethod;
|
||||
|
||||
/** Last invoke time of method */
|
||||
let reportPlaybackLastTime;
|
||||
|
||||
function reportPlayback(playbackManagerInstance, state, player, reportPlaylist, serverId, method, progressEventName) {
|
||||
|
||||
if (!serverId) {
|
||||
|
@ -57,7 +63,14 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
|||
addPlaylistToPlaybackReport(playbackManagerInstance, info, player, serverId);
|
||||
}
|
||||
|
||||
const now = (new Date).getTime();
|
||||
|
||||
if (method !== reportPlaybackLastMethod || now - (reportPlaybackLastTime || 0) >= 1e3) {
|
||||
console.debug(method + '-' + JSON.stringify(info));
|
||||
reportPlaybackLastMethod = method;
|
||||
reportPlaybackLastTime = now;
|
||||
}
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
apiClient[method](info);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue