Media item downloaded repeatedly when repeat mode is Player.REPEAT_MODE_ONE
See original GitHub issue[REQUIRED] Issue description
In 2.12.0, ExoPlayer will repeatedly download MediaItem until released, wasting user bandwidth.
https://i.imgur.com/nZDROLY.png All these requests happened within 10 seconds of playing.
[REQUIRED] Reproduction steps
Simply prepare a SimpleExoPlayer like so and check the network logs using your favorite MITM inspector.
exoPlayer.setMediaItem(MediaItem.fromUri("https://i.imgur.com/dgNL2jK.mp4"))
exoPlayer.prepare()
exoPlayer.repeatMode = Player.REPEAT_MODE_ONE
exoPlayer.seekTo(playbackTime)
This only happens with the new .setMediaItem()
& .prepare()
API.
The deprecated .prepare(MediaSource)
still works correctly.
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top Results From Across the Web
Repeat modes in ExoPlayer - Medium
You can enable this mode with player.setRepeatMode(Player.REPEAT_MODE_ONE); . Repeat All loops the entire timeline (all windows) indefinitely.
Read more >repeatMode | Apple Developer Documentation
The current repeat mode of the music player. ... The currently-playing media item, or the media item, within a queue, that you have...
Read more >Exoplayer Next button not clickable when Repeat Mode is ...
This method is called every time the player is switched to a new item or the playlist is changed. You can set the...
Read more >EAGET PLAY M18 USER MANUAL Pdf Download - ManualsLib
PLAY M18 media player pdf manual download. ... Download this manual ... press repeatedly to select speed REPEAT Select repeat mode, ONE, ALL,...
Read more >Windows Media Player repeatedly losing songs
I downloaded an album for the first time to my Windows Media Player 11 ... to play, burn, or sync an item that...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for working on caching, I appreciate the 2.12.0 changes that makes setting up a cache for SimpleExoPlayer much easier. But I’m talking about no-cache players, and I think you might be confusing Progressive vs Adaptive streams. 😃
Behavior <2.12.0, with no cache configured: Progressive streaming, using
.prepare(MedisSource)
-> only downloads once DASH, HLS using.prepare(MediaSource)
-> downloads non-stop (I understand the difference and expect that this is normal)Behavior >= 2.12.0, with no cache configured: Progressive streaming, using
.setMediaItem(MediaItem)
&.prepare()
-> downloads non-stop Progressive streaming, using.prepare(MediaSource)
-> only downloads once DASH, HLS using.prepare(MediaSource)
-> downloads non-stopBut let me spell out why I think this is a big deal. 😃
.setMediaItem(MediaItem) + .prepare()
- a new API in 2.12.0 - is meant to deprecate.prepare(MediaSource)
, yet they yield radically different behaviors when dealing with Progressive media types. This is a huge foot gun for anyone thinking this might just be another minor update. Especially since the javadocs for.prepare(MediaSource)
make it sound like a simple find-and-replace refactor, but there’s actually an undocumented breaking change when a Progressive media source is being passed in to.setMediaItem(MediaItem)
.If this inconsistency between prepare(MS) and prepare() is the way forward, I think it should at least be called out in the Javadocs.
Cool! I’m glad it’s working! 😃
It seems that
okHttpClient
does the caching (TIL). It probably caches files in a behaviour similar to a web browser (honouring cache-control, max-age headers and the like). TheDefaultMediaSourceFactory
that is in charge for doing the media item to media source conversion uses theDefaultDataSourceFactory
that makes HTTP requests with a plain http connection which is stateless and does not cache anything.If you want to have the media item API use okhttp, you can inject the
OkHttpDataSourceFactory
into the default media source factory when building your player (not compiled and tested that code below, beware, but it should work that way).