google / google/ExoPlayer

PreCache HLS MediaSource

Open
#9,337 4 comments 0 reactions 1 assignee Claimed by @marcbaechinger View on GitHub
question
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.