How to make a Video Player using Native Android that have resolution switching ability like we see in YouTube?

梦想的初衷 提交于 2020-01-21 19:41:24

问题


I want to use a video player eg. using ExoPlayer in android app which will support switching of resolution like we see in YouTube.

My API have video files for 480p,720p,1080p. I want to give those options in the player and can switch it from the player itself and will play the respective files from URL.

I have seen solutions like track selector etc,but does that work for online files? I have links like :

www.example.com/videos/480/demo.mp4
www.example.com/videos/720/demo.mp4
www.example.com/videos/1080/demo.mp4

Please suggest if there is any other solutions like API change or any other protocols etc.


回答1:


Why you don't convert your mp4 file to hls or mpd streaming format with ffmpeg so you can stream it chunk by chunk and the player will select the best resolution based on his algorithm?




回答2:


Have a look at this project, this allows user to select resolution manually via track selection from hls stream encoded by ffmpeg.

https://github.com/namespace7/HLS_Player

To generate hls stream from a video,go through this link https://superuser.com/a/1302736/1108219



来源:https://stackoverflow.com/questions/58957431/how-to-make-a-video-player-using-native-android-that-have-resolution-switching-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!