简体   繁体   中英

Android Exoplayer - How to show available qualities (tracks) while playing offline

I am working on an application in which users can stream or download videos. I implemented the same using ExoPlayer 2.9.6. Currently while playing the downloaded content when I try to switch the quality, it shows only the downloaded tracks. I know its default behavior. My requirement is to show all other available qualities too (which is not available offline) and user should be able to switch to another quality if network is available.

Is there any way I can achieve this ?

You mean, I think, that you want ExoPlayer to use two separate sources for the content - one the local file, and the other the online streams.

I am guessing that you would have a lower quality track downloaded to reduce download size and switch to higher quality if you have availabe bandwidth? The downloaded file would need to be segmented in the HLS or DASH streaming format, I would guess for the easiest approach.

I don't believe this is available as standard with ExoPlayer (AFAIK) but you could implement it using a custom TrackSelector:

All available tracks from the media source are passed to this, but in your case you would have two sources so would need to add logic to get the track info from the other source also and then decide which to use.

It's an interesting use case, especially to get transitions from local to streamed smoothly, so it might be worth sharing your approach and maybe others with similar requirements would consider contributing to the effort also.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM