fix: further limit extraneous events from playback reporting

This commit is contained in:
Lei Nelissen
2024-07-25 15:45:26 +02:00
parent 0b13e69854
commit c9f7f71194
4 changed files with 38 additions and 11 deletions

View File

@@ -31,6 +31,9 @@ export async function sendPlaybackEvent(
TrackPlayer.getPlaybackState(),
]);
// GUARD: Ensure that no empty events are sent out
if (!activeTrack?.backendId) return;
// Generate a payload from the gathered data
const payload = {
VolumeLevel: volume * 100,
@@ -41,8 +44,8 @@ export async function sendPlaybackEvent(
PositionTicks: Math.round((lastPosition || currentPosition) * 10_000_000),
PlaybackRate: 1,
PlayMethod: 'transcode',
MediaSourceId: activeTrack?.backendId || null,
ItemId: activeTrack?.backendId || null,
MediaSourceId: activeTrack.backendId,
ItemId: activeTrack.backendId,
CanSeek: true,
PlaybackStartTimeTicks: null,
};