Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep playback at live edge of custom web socket stream #5604

Closed
TroyStopera opened this issue Mar 6, 2019 · 2 comments
Closed

Keep playback at live edge of custom web socket stream #5604

TroyStopera opened this issue Mar 6, 2019 · 2 comments
Assignees
Labels

Comments

@TroyStopera
Copy link

TroyStopera commented Mar 6, 2019

[REQUIRED] Searched documentation and issues

Stack Overflow, GitHub, and source code/documentation. We have some custom-built ExoPlayer components, so it's been hard to even know what I'm looking for.

[REQUIRED] Question

I had asked a previous question about a custom implementation for raw NAL units. We were able to get that working well enough with a custom Extractor, ElementaryStreamReader, and BaseDataSource. We have now circled back around to it to improve performance and there are 2 main issues:

  1. Our stream, coming from the same source, is out of sync between Android and the web. Sometimes it is a bit ahead, and sometimes it is far behind.
  2. The stream is a low-latency live feed. After buffering it continues from the last frame before the buffering started, causing the feed to slowly have more and more latency.

The question is, what approach can we use to ensure the playback is always playing the latest frames? It doesn't matter to us if frames are skipped/discarded, as this feed is live. I've looked into Extractor.RESULT_SEEK as well as LoadControl but I'm not sure if that is even the right place to start. Thank you.

@mikemm13
Copy link

Hi @TroyStopera, I'm working in a project with the same characteristics as yours.

I noticed the same issue as you and what I've done is:

  • Subscribe to the player EventListener
  • Detect the events related with buffering and recovering
  • Remove old packets and perform a seekToDefaultPosition(). This seeks your playback as close as possible to the live edge.

For me it's not the perfect solution, sometimes playback is really far behind the same stream in iOS, but it seems to recover after buffering. At least is playing in the live edge.

Maybe someone have a better solution??

@tonihei tonihei self-assigned this Mar 18, 2019
@tonihei
Copy link
Collaborator

tonihei commented Mar 18, 2019

The main options you have available are seeking to the live edge with player.seekTo(player.getDuration()) whenever buffering occurs or speeding up playback a bit (player.setPlaybackParameters(...)) so that playback can catch up with the live edge. To reduce general rebuffer delay, you can also try to set the bufferForPlaybackAfterRebufferMs value of the DefaultLoadControl to zero, so that the player resumes playback as soon as it has any samples to play. See also #4217 for a similar issue.

Note that we are also looking into better out-of-the-box support for low-latency streaming soon. There are #5011 and #4904 to track that.

@tonihei tonihei closed this as completed Mar 18, 2019
@google google locked and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants