samrobinson d0afb96c40 Implement repeat mode for CompositionPlayer.
-----

Context:
* Each sequence is wrapped as a single MediaSource, each being played
by an underlying ExoPlayer.
* Repeat mode is typically implemented in Players as a seek to the next
item in the playlist.

-----

This CL:

Repeat mode is triggered by listening for when the main input player
sees a play when ready change due to the end of the media item.

There is a slight delay at the end of the playback, before it repeats.
Setting repeat mode on the underlying players addresses this, but means
that the players will seek without waiting for the CompositionPlayer,
and as such previewAudioPipeline does not get the correct signals
around blocking/flushing.

PreviewAudioPipeline - The seek position can validly be C.TIME_UNSET,
however preview pipeline did not handle this case.

CompositionPlayer getContentPosition is given (through a lambda) as a
supplier to the State object, which means any comparisons between
previous/new state for this value does not work. In SimpleBasePlayer,
there is logic to use the positionDiscontinuityPositionUs for the
position change (see getPositionInfo called from
updateStateAndInformListeners), however this logic is not considered in
getMediaItemTransitionReason, so a condition needed to be added for
this case.

-----

Tests:
* Dump files clearly show the position and data is repeated.
* Assertions on the reasons for transitions or position
discontinuities.
PiperOrigin-RevId: 653210278
2024-07-17 06:22:02 -07:00
..
2024-05-07 09:26:36 -07:00
2024-05-07 09:26:36 -07:00
2021-10-27 09:12:46 +01:00

Demos

This directory contains apps that demonstrate how to use Android media modules, like ExoPlayer. Browse the individual demos and their READMEs to learn more.

Running a demo

From Android Studio

  • File -> New -> Import Project -> Specify the root media folder.
  • Choose the demo from the run configuration dropdown list.
  • Click Run.

Using gradle from the command line:

  • Open a Terminal window at the root media folder.
  • Run ./gradlew projects to show all projects. Demo projects start with demo.
  • Run ./gradlew :<demo name>:tasks to view the list of available tasks for the demo project. Choose an install option from the Install tasks section.
  • Run ./gradlew :<demo name>:<install task>.

For example, ./gradlew :demo:installNoDecoderExtensionsDebug installs the ExoPlayer demo app in debug mode with no optional modules.