pillarbox-apple icon indicating copy to clipboard operation
pillarbox-apple copied to clipboard

Add state for initial readiness to play?

Open defagos opened this issue 4 months ago • 2 comments

Can your answer be found elsewhere?

  • [x] I have searched existing issues and found no similar question.

  • [x] I have browsed the available documentation and found no answer to my question.

Detailed question

From @NicolasBrunnerSRF:

Question regarding Player.playbackState incoming!

We are currently building our new VideoFeed. Every VideoItem in the Feed can now have its own PlayerInstance thanks to Pillarbox. It works great :partying_face:

There is an autoplay feature where we automatically detect which video is in the “center” of the screen and start playing it. Other videos that have not yet started playing should display a TeaserImage (which does not correspond to the first frame of the video). Achieving this seems complicated to us:

  • When setting the player.items (only one in our case), the player state will change from .idle to .paused
  • We rely on the player state to decide wether we will show the TeaserImage on top of the player. However we don’t want to use .paused, since when the user pauses the video after some time, we don’t want to show the TeaserImage.
  • This means we need to keep some News App internal state “.ready” or “playerIsReadyButHasNotYetStartedPlaying”.

Is there another/better way of doing this?

defagos avatar Oct 02 '24 13:10 defagos