mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00

This change introduces two new types of method to `SubtitleParser`: 1. `parse()` methods that take a `Consumer<CuesWithTiming>` and return `void` 2. `parseToLegacySubtitle` method that returns `Subtitle` (1) ensures that in the new 'parse before SampleQueue' world we can write cues to the `SampleQueue` as soon as they're ready - this is especially important when parsing monolithic text files, e.g. for a whole movie. (2) ensures that during the transition, the legacy 'parse after SampleQueue' behaviour doesn't see any regressions in 'time to first cue being shown'. Previously we had a single implementation to convert from `List<CuesWithTiming>` to `Subtitle`, but this relies on the complete list of cues being available, which can take a long time for large files in some formats (with ExoPlayer's current parsing logic). By allowing implementations to customise the way they create a `Subtitle`, we can directly re-use the existing logic, so that the 'time to first cue being shown' should stay the same. This change migrates all **usages** to the new methods, but doesn't migrate any **implementations**. I will migrate the implementations in follow-up CLs before deleting the old list-returning `parse()` methods. PiperOrigin-RevId: 565057945
ExoPlayer module
This module provides ExoPlayer
, the Player
implementation for local media
playback on Android.
Getting the module
The easiest way to get the module is to add it as a gradle dependency:
implementation 'androidx.media3:media3-exoplayer:1.X.X'
where 1.X.X
is the version, which must match the version of the other media
modules being used.
Alternatively, you can clone this GitHub project and depend on the module locally. Instructions for doing this can be found in the top level README.