How to change video playback quality in AVPlayer?
You cannot simply do this with AVplayer
. you need a different url for high quality video. When the user chooses a different quality, you can switch to this video using the replaceCurrentItemWithPlayerItem method for the AVPlayer.
AVPlayerItem *playeriem= [AVPlayerItem playerItemWithURL:urlOfSelectedQualityVideo];
[playeriem seekToTime:player.currentTime];
[player replaceCurrentItemWithPlayerItem:playeriem];
source to share
To do things like converting videos, you have to use the FFmpeg library . Try to find some libraries that use ffmpeg for github.
Like this one: https://github.com/iMoreApps/ffmpeg-avplayer-for-ios-tvos
You cannot do this with AVPlayer. When streaming, you use M3U index files, TS files containing video data, and just switch streams.
Check out Apple HLS Documentation and Playlist Examples .
source to share
You can also create multiple versions of m3u8 with lower quality video streams, say 128k to 650k and another from 650k to higher bitrates, and use the higher quality url suggested in the answer above.
AVPlayerItem *playeriem= [AVPlayerItem playerItemWithURL:urlOfSelectedQualityVideo];
source to share