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

Decide behavior at playlist item end #173

Closed
4 tasks done
defagos opened this issue Jan 6, 2023 · 5 comments
Closed
4 tasks done

Decide behavior at playlist item end #173

defagos opened this issue Jan 6, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@defagos
Copy link
Member

defagos commented Jan 6, 2023

As a user I want a consistent user experience when playback ends. As a Pillarbox integrator I want to have flexibility in choosing how the player behaves when playback ends, in particular at the end of a playlist.

Acceptance criteria

The following questions have found an answer:

  • How must the player behave when reaching the end of the playlist? Should the current item index be returned to nil?
  • Should we let actionAtItemEnd be customized? (intuition: probably)
  • Should we have built-in meaningful behaviors instead of letting integrators directly deal with actionAtItemEnd to get the behavior they want. For example:
    • Autoplay: Continue automatically for all items except the last one, pause at the end of the last one.
    • No autoplay: Pause at the end of each content
  • If we provide built-in behaviors, should we still provide a manual behavior where integrators can still customize actionAtItemEnd directly?
  • In general how should states evolve during playback depending on actionAtItemEnd? E.g.:
    • If playback continues automatically should the player briefly reach the ended state (if kept) before turning to playing again? Or should it stay playing all the time?
    • What should be the state when all items have been exhausted? (e.g. ended only for the last item in the playlist if pausing at end, otherwise returning to idle).
  • How should the player behave after the last item ended but a previous item is then moved after it (or another item is appended)? Should playback resume depending on actionAtItemEnd or built-in behaviors, if any? Same question if the last item, whose end has been reached, is moved elsewhere in the playlist.
  • We should also ensure that control center metadata is correctly updated, especially after the playlist has been entirely exhausted.

Expected output:

  • The behavior has been discussed and documented (this possibly requires some PoC code to be written to know what is possible).
  • Dedicated implementation stories have been written.

Hints (for stories)

  • Some tests (e.g. testCurrentItemIndexAfterPlayerEnded) might have to be updated or added in the process.
  • Control center metadata and commands must have a consistent state as well.

Tasks

  • Investigate what is possible with a PoC.
  • Discuss within the team and reach an agreement.
  • Document the agreement.
  • Write the stories.
@defagos defagos added this to Pillarbox Jan 3, 2023
@defagos defagos converted this from a draft issue Jan 6, 2023
@defagos defagos added the enhancement New feature or request label Jan 6, 2023
@defagos defagos moved this from 📋 Backlog to ✏️ Draft in Pillarbox Jan 9, 2023
@defagos defagos changed the title Behavior at playlist end Behavior at playlist item end Jan 20, 2023
@defagos defagos changed the title Behavior at playlist item end Decide behavior at playlist item end Jan 20, 2023
@defagos defagos moved this from ✏️ Draft to 📋 Backlog in Pillarbox Jan 20, 2023
@defagos defagos moved this from 📋 Backlog to 🚧 In Progress in Pillarbox Mar 14, 2023
@defagos
Copy link
Member Author

defagos commented Mar 14, 2023

We currently have an inconsistency at the end of playback. The current publisher preserves the last item while the queue player moves to the next item (default actionAtItemEnd). As a result the control center displays the media which just has been finished, which does not match the player true state.

So:

How must the player behave when reaching the end of the playlist? Should the current item index be returned to nil?

Should behave according to actionAtItemEnd. Currently we have the default behavior but later we could also expose other modes. We could either provide the built-in mode or we could add smarter modes like move forward in a playlist but pause on the last item, for example.

Should we let actionAtItemEnd be customized? (intuition: probably)
Should we have built-in meaningful...
If we provide built-in behaviors

Possibly later, we don't know what users need yet. Will write a story.

In general how should states evolve...
We should also ensure that control center metadata is correctly updated

Related problems. Will write a separate story.

How should the player behave

Will write a separate story.

@defagos
Copy link
Member Author

defagos commented Mar 14, 2023

Created issues #304, #305 and #306.

@defagos defagos closed this as completed Mar 14, 2023
@github-project-automation github-project-automation bot moved this from 🚧 In Progress to ✅ Done in Pillarbox Mar 14, 2023
@defagos defagos reopened this Jan 17, 2024
@github-project-automation github-project-automation bot moved this from ✅ Done to 📋 Backlog in Pillarbox Jan 17, 2024
@defagos
Copy link
Member Author

defagos commented Jan 17, 2024

As discussed with @mbruegmann and @NicolasBrunnerSRF and the rest of the team:

  • We can expose the raw actionAtItemEnd property without any clever behavior.
  • When set to .pause we should change the player playback state to .playing or .paused if the user seeks back to a prior position after the player reached the end (in a paused state).
  • We should add a setting to the demo to change this behavior globally for our custom player. We should also ensure we can implement a nice behavior for the playlist demo in the .pause case (automatically resume and advance to the next item when reaching the end, except for the last one, all with a gapless playback experience).
  • We could improve the story demo as well.

This behavior would be consistent with other platforms:

  • The web player already pauses when reaching the end (no playlist support).
  • Android has the same setting.

@defagos
Copy link
Member Author

defagos commented Jan 17, 2024

To let apps chain between items something like the following should likely be possible, maybe with a dedicated shorter formalism:

// ...
.onReceive(player.propertiesPublisher.slice(at: \.playbackState).receiveOnMainThread()) { state in
    if state == .ended {
        player.play()
        player.advanceToNextItem()
    }
}

A short test shows that this jumps to the last item in the playlist so we probably have a minor bug when advancing to the next item is made at item end.

@defagos
Copy link
Member Author

defagos commented Jan 19, 2024

A dedicated implementation task has been created. Closed.

@defagos defagos closed this as completed Jan 19, 2024
@github-project-automation github-project-automation bot moved this from 📋 Backlog to ✅ Done in Pillarbox Jan 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

No branches or pull requests

2 participants