I use AVPlayer to play videos on YouTube, for each YouTube video ID I get a couple of stream URLs in different qualities.
I want to reproduce a specific stream quality according to the state of the network. For example, if the user is connected to 3G, I want to play the URL of the lowest quality, but if the user goes to Wi-Fi, I want to seamlessly switch to the stream of the best quality.
This is nothing new, youtube does it in its application and many others.
So I wonder what is the best way to do this type of switching using AVPlayer , I donβt want the user to notice the possibility of switching as much as possible without pausing playback or buffering the video.
Any tips?
I'm not sure if this feature is supported on youtube servers or if I need to do this on the client side.
source share