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

Support playlists (with buffering of next track when current track nears the end) #1270

Closed
wbo4958 opened this issue Feb 16, 2016 · 3 comments

Comments

@wbo4958
Copy link

wbo4958 commented Feb 16, 2016

Hello all,

I wan't to play 10 songs one by one, auto-switch by STATE_ENDED. When finished the first song, exoplayer will download the second song and prepare to play, so it may result some delay to play second song if bad bandwidth. So I was wondering if there are some policy to pre-load second song when first song is playing?

BR,

@ojw28 ojw28 changed the title Question, is it possible to pre-cache the next song? Support playlists (with buffering of next track when current Question, is it possible to pre-cache the next song? Feb 16, 2016
@ojw28 ojw28 changed the title Support playlists (with buffering of next track when current Question, is it possible to pre-cache the next song? Support playlists (with buffering of next track when current track nears the end) Feb 16, 2016
@ojw28
Copy link
Contributor

ojw28 commented Aug 31, 2016

This is supported in dev-v2. You'll need to build a MediaSource for each song that you want to play, then build a ConcatenatingMediaSource that wraps the 10 individual MediaSource instances. If you then provide the ConcatenatingMediaSource to the player, it'll play the tracks seamlessly, maintaining a consistent buffering policy across the transitions.

@ojw28 ojw28 closed this as completed Aug 31, 2016
@nioncode
Copy link

How to apply this if we have many (e.g. 100) files in the playlist? Is it possible to just provide a FIFO system, where ExoPlayer asks us for the next MediaSource in the playlist whenever it wants to prepare for the next track? That would allow to lazily populate the MediaSources without wasting memory for having all these tracks in the playlist that might not even be played if the user stops playback before reaching them.

@ojw28
Copy link
Contributor

ojw28 commented May 22, 2017

You could implement your own MediaSource similar to ConcatenatingMediaSource, but backed by something like a Cursor (or whatever). Being able to lazily add to a MediaSource as a direct feature of the library is tracked by #1706.

@google google locked and limited conversation to collaborators Jun 28, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants