Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
636 views
in Technique[技术] by (71.8m points)

android - Is it possible to change resolution of exoplayer manually?

I'm working on a project that use Exoplayer2 for HLS video streaming. Adaptive streaming is working well in my exoplayer, but i want to implement a feature that user can change the resolution (144p,240p,480p..)of the video manually from UI. I got the resolution of the playing video from TrackGroup API. But don't know how to set the resolution value into the playing video manually. Thanks

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You can do this using the track selector functionality in Exoplayer2 - it essentially limits the tracks that the adaptive bit rate selection functionality in the player can select from.

It can only select from the available tracks in the stream index file, the manifest file. Hence, your choice of resolutions/bit rates is limited to whatever bitrate, resolution etc the stream provider has made available - i.e. the user can't just choose an arbitrary bit rate or resolution that they would like, if it is not one of the available ones in the manifest file (the video track index file).

To have just one track you simply only allow that one.

This functionality is included in the demo - here is an example screen shot from one of their blogs about this:

enter image description here

More details specifically on track selection here (it is also linked from the Exoplyar GitHub page): https://medium.com/google-exoplayer/exoplayer-2-x-track-selection-2b62ff712cc9


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

56.9k users

...