-
Notifications
You must be signed in to change notification settings - Fork 314
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
Redownload audio file from source #1348
Comments
My best attempt to make this work, is to force the player to get a new item. Thoughts?
|
By default, ExoPlayer will re-load the file on every repeat - that's what I observe in the demo app (I added some logging to Please could you clarify exactly what you observe? |
It's hard for me to tell, I need to test again. I did notice when tracing the internet traffic through Android Studio that on repeat (when the audio started again) there was no corresponding network traffic. |
@icbaker how do you know it's supposed to re-load on repeat? I couldnt find anything in the source to say/show that's what's happening. There was another post I found that said it was behaving that way, but I couldnt replicate their findings. |
I would expect to see the network traffic happen when the data is loaded, which generally won't be at the same time as it's played, due to buffering - so what you've described here doesn't sound like it proves the file isn't being re-loaded for each repeat. By default ExoPlayer buffers 50s ahead of the playback position (and this extends into 'future' playlist items, including repeats, to avoid pausing to re-buffer at item transitions). For example, this means that if you repeat a 5s item, I'd expect you to see about 10 loads immediately after starting playback. Whereas if you repeat a 1min item, I'd expect you to see a single load at the start of playback, then another one 10s into playback (1min - 50s).
As I mentioned above, I added logging in |
Thank you. I'm an idiot, where are you finding that method? @icbaker. The only issue I see with pre-loading is that you may be loading the file well before you need the update. However, my audio is ~2min long so you're saying there might a reload of data ~50 sec ahead of when it's done playing? That's not too bad..... |
media/libraries/datasource/src/main/java/androidx/media3/datasource/DefaultDataSource.java Line 248 in d833d59
The 50s is only a default, you can customize it by providing a custom |
I have an mp3 file that get's updated at the source every few minutes. On my end, the URL/URI is the same, but the audio file changes (text to speech audio).
If I am playing the file on repeat: player.setRepeatMode(Player.REPEAT_MODE_ONE).
How can I get ExoPlayer or MediaSessionService to redownload the file from the source?
It doesn't even matter if it's on repeat, I am using a MediaSessionService so it's loaded the file in the background. I need to redownload or reload or refresh the audio.
I am guessing I will need to use the DownloadService (https://developer.android.com/media/media3/exoplayer/downloading-media). I'd rather not add the complication for this if there's any alternatives. It's a feature of our app they may never or rarely get used, but we want support for it.
Thanks for your help.
The text was updated successfully, but these errors were encountered: