I want to change the quality of a youtube video that is being loaded and displayed from the internet inside my flutter application. I am using youtube_player_flutter package and i am getting the data like videoURL/thumbnail and video title using youtube_api. Now i want to give user an option to watch video in different qualities so they can sava mobile data if/when they want.I am able to display all the videos with thumbnails and play them in my app using the youtube_player_flutter package but i want to control the video quality being played.
So far I have tried making a DropDownButton and attaching a callback with it which changes the size of the video by using
_videoController.setSize(Size size)
method. It just changed the size of the video in which video was being played.
My callback was as such.
_changeVideoQuality(actualQuality) async { if (actualQuality == 0) { double width = 480; double height = 360; _videoController.setSize(Size(width, height)); }
Then i also tried if i could get the available videoQualities from youtube using youtube_api package. There is no such thing in the JSON_data that is recieved after making an http call the the youtube_api that could help me in changing the video. I can't figure it out. have tried ChatGPT as well but it mixes two different (youtube_player_flutter/youtube_player) packages. In the second one according to one blog there is a property in player_controller that controls the video_quality but i couldnt find its documentation in pub.dev. I also saw only one question related to this but its also unanswered. question