PreCache HLS MediaSource
- Dominant language
- Java
- Stars
- 21.9k
- Forks
- 6k
- PR merge metrics
- No merged PRs in 30d
Description
Goal: We're attempting to precache hls audio streams with the goal of faster initial playback upon selection of a single stream.
References: We've looked at the prior ExoPlayer references including: https://github.com/google/ExoPlayer/issues/7887 and https://medium.com/google-exoplayer/downloading-adaptive-streams-37191f9776e
Initial Attempt:
We initially tried using the CacheWriter approach and set up our player as:
```
SimpleExoPlayer.Builder(context)
.setBandwidthMeter(bandwidthMeter)
.setAudioAttributes(
AudioAttributes.Builder()
.setContentType(C.CONTENT_TYPE_MUSIC)
.setUsage(C.USAGE_MEDIA)
.build(),
true
)
.setTrackSelector(DefaultTrackSelector(context))
.setLoadControl(DefaultLoadControl())
.build()
```
and precache the streams (using no length in the DataSpec to prevent EOF crashes) as follows:
```
val dataSpec = DataSpec(Uri.parse(uri))
CacheWriter(
cacheDataSource,
dataSpec,
true,
null,
progressListener
).cache()
```
Results: We find there is a minimal download of less than 100 bytes from the progress listener
Question: Can you please confirm that the CacheWriter is intended for progressive streams and that we must download the content for adaptive streams such as HLS? And if so, is there an option to only download a fraction of the HLS stream as we're simply looking for faster startup time? Thanks.
Contributor guide
Assessment
This issue has not been assessed yet.