Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvement: use Player.Open to resume #1200

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

wutschel
Copy link
Collaborator

@wutschel wutschel commented Nov 29, 2024

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:

  1. Playlist.Clear
  2. Playlist.Add -item-
  3. Player.Open -playlist index- (does not support „resume“)
  4. Wait
  5. 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.

  1. 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 used addPlayback 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

Avoid to use Playlist.Clear, Playlist.Add and Player.Open with playlist index. Instead, directly call Player.Open with the item, which then allows to resume the position via API. As Player.Open anyway cause the playlist to be cleared and updated, this is a much simpler and more robust way to resume the playback.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant