google / google/ExoPlayer

Latency playing RTSP video

Open
#11,221 9 comments 0 reactions 1 assignee Claimed by @microkatz View on GitHub
question
Dominant language
Java
Stars
21.9k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

I'm using ExoPlayer for RTSP streaming video.
When I initially set the mediaSource and prepare the player, the video starts to play after ~10sec.
So, the video is already 10 sec behind the edge of the stream.

I use a listener like this:
```
override fun onPlaybackStateChanged(state: Int) {
super.onPlaybackStateChanged(state)
if (state == Player.STATE_READY) {
val bufferedPosition = exoPlayer.bufferedPosition
exoPlayer.seekTo(bufferedPosition)
}
}
```
in order to seek to the end of the stream once the video starts to play.
This cause a delay of another 10 seconds that the video freezes (due to buffering) but at the end the player almost is synced to the end of the stream.

I use this configuration for load control and livePlaybackSpeedControl:
```
val loadControl = DefaultLoadControl.Builder()
.setBufferDurationsMs(
400,
3000,
400,
400
)
.build()
val livePlaybackSpeedControl = DefaultLivePlaybackSpeedControl.Builder()
.setFallbackMinPlaybackSpeed(0.5f)
.setFallbackMaxPlaybackSpeed(1.5f)
.build()
```
Is there anything I can do to minimize these 10 seconds delays?

Thanks in advance!

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.