androidx / media

Jetpack Media3 support libraries for media use cases, including ExoPlayer, an extensible media player for Android
https://developer.android.com/media/media3
Apache License 2.0
1.67k stars 397 forks source link

Ability to set SntpClient pool interval #1784

Closed nikitapn closed 2 weeks ago

nikitapn commented 3 weeks ago

Use case description

We are playing dash content with the absence of UTCTiming element in the manifests. Because of that, SntpClient is used as wall clock time source. There is no option to insert UTCTiming on server side. Our app never unloads itself from memory since it runs as launcher. After a while (approximately a week) there is a significant drift in SystemClock.elapsedRealtime(), which makes player to do inaccurate requests for media segments which leads to player stops playing live content, since it requests segments that do not exist yet on the server.

Proposed solution

It would be great to have a new method for SntpClient that allows for setting a custom synchronization interval or leaving it unset. Something like:

SntpClient.setNtpPoolInterval(12L * 3600L * 1000L)

Proposed example: https://github.com/androidx/media/commit/44751be359386bc30bee85bd076b398debbb4357

-- There is already a similar issue: https://github.com/androidx/media/pull/697 But the sync interval is hardcoded to 10 minutes, We don't think It needs to be so frequent, and It would be much better to have an option to set a desired synchronization interval in runtime.

marcbaechinger commented 2 weeks ago

Thanks for your suggestion.

Yeah, that sound like a reasonable request. I'm going to take the pull #1794 that allows reinitialization.

I'd appreciate if you'd join the discussion there! I close this issue instead! Thanks!