The PlaybackManager was a giant class that handled UI bindings, fetching
stream URLS, playback logic.
It now has been split up into:
- ViewModel::PlaybackManager, which handles UI interfacing and allowing
to swap out the Model::Playback implementation on the fly.
- Model::PlaybackManager, which is an interface for what a
PlaybackManager must do, handling queues/playlists, and controlling a
player.
- Model::LocalPlaybackManager, which is an Model::PlaybackManager
implementation for playing back Jellyfin media within the application.
- Model::PlaybackReporter, which reports the current playback state to
the Jellyfin server, for keeping track of played items.
- Model::Player, which handles playing back media from an URL and
the usual play/pause et cetera.
In a future commit, this would allow for introducing a
Model::RemoteJellyfinPlaybackManager, to control other Jellyfin
instances.
The following bugs should have been fixed:
* The PlaybackManager no longer starts playing again after
PlaybackManager.stop() has been called.
* The PlaybackManager will no longer get into an invalid state when
next() is called many times fast.
* The PlaybackManager now exposes its error information when the
PlaybackUrl could not be fetched.
* The PlaybackManager will keep a playbackState of Playing as long
as it is not stopped and while in a playlist. Previously, it would
stop and start everytime the next item got loaded.
Besides MPRIS support, this also adds support for hasPrevious() and
hasNext() in several parts to determine whether the
player/playlist/shuffler has a previous or next item.
THe idea behind the switching was to provide gapless playback, but it
made the code too complicated and to intertwined with QtMultiMedia.
I might attempt to implement it later, but I probably will put the code
in a separate class to make it easier to swap the QtMultiMedia
implementation with a multimedia implementation for a player with better
support for gappless playback.