google / google/ExoPlayer

How to decrease the start time for a 2 second video

Open
#8,817 3 comments 0 reactions 1 assignee Claimed by @AquilesCanta View on GitHub
needs triage question
Dominant language
Java
Stars
21.9k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Exoplayer version: 2.13.2
**Description:** I am trying to play a 2-sec mp4 video which is shown as part of our splash screen. I have been able to download the video using `DownloadManager` and able to play it locally. The video duration is ~ 2000ms and the time window to show this video is also ~2000 ms(as this is part of the app launch, this 2000ms is fixed time window). When we prepare the video, I see that `exoplayer` take around ~400ms to ~800ms to actually start the playback i.e from `STATE_BUFFERING` to `STATE_READY`. Due to this few frames at the last are lost.

```
playWhenReady : false playbackState : 2 current time : 1618368609319
playWhenReady : false playbackState : 3 current time : 1618368609940
playWhenReady : true playbackState : 3 current time : 1618368609954
```

I looked in the `LoadControl` and I am trying to come up with the lowest settings for buffers, so the time it takes to actually start the video is reduced as much as possible. The problem is I am not able to come up with the right params or if there is any other way to reduce this latency. I tried changing values for buffers and `targetBuffers` but no help:

```
fun getSimpleExoPlayer(context: Context): SimpleExoPlayer {
return SimpleExoPlayer.Builder(context)
.setMediaSourceFactory(DefaultMediaSourceFactory(cacheDataSourceFactory))
.setLoadControl(DefaultLoadControl.Builder().
setBufferDurationsMs(0, 0, 0, 0) // tried with 100ms as well.
.setTargetBufferBytes(-1) // Tried with 0 as well here
.setPrioritizeTimeOverSizeThresholds(true)
.build())
.build()
}
```

I have sent the bug report and stream to the dev.exoplayer@gmail.com

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.