-
Notifications
You must be signed in to change notification settings - Fork 404
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
How to fetch media urls for media items just in time? #13
Comments
Starting from using bare ExoPlayer, I'd suggest updating your code incrementally as follows:
At this point you're adding and removing |
Thanks for the explanation, I've got the idea. I'll have to play around with this for a few more days to fit this into our business logic & I'll close the issue then. Thanks a lot! |
Yep, works for our needs, thanks! We'll combine the approach you suggested with passing custom urls to resolver to parse them for getting needed information to fetch the stream link (smth similar can be found here) |
I'm trying to migrate an app from bare ExoPlayer to Media3. The app heavily uses background audio playback, so I thought that I should go with session demo.
Due to our backend limitations, we have to request media url from server separately for each media item. Previously we were using
exoPlayer.setMediaSource()
with aConcatenatingMediaSource
that relied onDataSource
that handled just in time fetching logic. I think a pretty similar example can be found here.As far as I understand, I am supposed to use
MediaController
for controlling the underlying player to ensure background playback. However,MediaController
does not havesetMediaSource()
and instead hassetMediaItems()
method.Personally, I see 2 options and so far they do not seem to be viable:
MediaSession.MediaItemFiller
& fetch the url infillInLocalConfiguration()
– however, I suspect that when usingsetMediaItems()
it will try to load all the items' urls & furthermore block the main threadMediaController
& instead directly interact withsetMediaSource()
ofExoPlayer
that would be stored as a field inMediaLibraryService
& used to create aMediaLibrarySession
. However, I think this will create a ton of issues for syncing the media session and ensuring background workSo could you please explain me how do I implement just in time links fetching with Media3?
The text was updated successfully, but these errors were encountered: