Steve Mayhew 701f343ee5 Fixes issues with EXTINF duration conversion to microseconds
The HLS Parser converts from a string decimal duration in seconds into long
 microseconds.
Because the conversion passes through a java double type it can result in
representation errors.

For example:

`#EXTINF:4.004`  -> `Segment.durationUs` of 4003999

This matters because the first sample (which is the IDR) for a segment will be discarded following a seek because of the logic in the `SampleQueue`:

````java
    buffer.timeUs = timesUs[relativeReadIndex];
    if (buffer.timeUs < startTimeUs) {
      buffer.addFlag(C.BUFFER_FLAG_DECODE_ONLY);
    }
````
2021-10-18 17:04:29 -07:00
..

ExoPlayer HLS module

Provides support for HTTP Live Streaming (HLS) content in ExoPlayer.

Getting the module

The easiest way to get the module is to add it as a gradle dependency:

implementation 'com.google.android.exoplayer:exoplayer-hls:2.X.X'

where 2.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.

Using the module

Adding a dependency to this module is all that's required to enable playback of HLS media items added to ExoPlayer in its default configuration. Internally, DefaultMediaSourceFactory will automatically detect the presence of the module and convert an HLS MediaItem into an HlsMediaSource for playback.

Similarly, a DownloadManager in its default configuration will use DefaultDownloaderFactory, which will automatically detect the presence of the module and build HlsDownloader instances to download HLS content.

For advanced playback use cases, applications can build HlsMediaSource instances and pass them directly to the player. For advanced download use cases, HlsDownloader can be used directly.

  • Developer Guide.
  • Javadoc: Classes matching com.google.android.exoplayer2.source.hls.* belong to this module.