radio4000 / components

web-components to build the r4 interfaces, uses the sdk
https://components.radio4000.com/
1 stars 0 forks source link

Improve play logic #164

Closed oskarrough closed 5 months ago

oskarrough commented 5 months ago

We currently start playing in three ways:

When you play a channel, there are no tracks, we need to load and set them + queue the first track.

When you play a track, we also don't pass any tracks, but there might be some.

Before this PR we'd always fetch all tracks and set them. Triggering logic both in r4-app and radio4000-player.

After this PR we avoid that. We detect if there are tracks loaded already and compares playlist title and track length. If they are identical, we know the tracks are already loaded, and we skip reloading all of them from the server tracks and simply queue the selected track.

I also changed r4-player to no longer accept a config, but isPlaying: Boolean. We didn't use anything else. Still need to clean up the logs and would like feedback if it also works for others before merging.