Improvement: use Player.Open to resume #1200
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This change takes care of issue reports regarding non-reliable resume functionality and at the same time addresses review comments in the nearly 4 years old #139.
Background
The remote app's playback is centered around playlists. When playing an item, the app first clears the playlist, then adds the item to the playlist and finally plays the playlist item. But when starting playback of a playlist index,
Player.Open
does not support the option to resume playback. Instead, the app added a seek to the desired position. Before seeking, the player needed to start playback, so a sleep of 1 second was added. This worked reasonably ok, but there were reports of unreliable resume or a glitchy user experience as users could see the playback start, followed by seek.Old sequence:
Playlist.Clear
Playlist.Add
-item-Player.Open
-playlist index- (does not support „resume“)Player.Seek
-position-Updating the resume functionality
The new implementation does not use the playlist API at all. It directly calls
Player.Open
to resume playback for the desired item. As calling the playback directly also cleans the playlist and adds the resumed item, there is no loss of functionality.Playlist.Open
-item- -resume-Low risk approach
As we are very near releasing 1.16, but this improvement is expected to make resume more reliable, I made the change without too much rework. A new method
resumePlayback
is introduced, which is a copy of the formerly usedaddPlayback
and only changes the sequences as described before. An unused ivar is removed.In a dedicated future PR I will rework the other playback methods to respect the same logic.
Summary for release notes
Improvement: use Player.Open to resume