如何像YouTube一样更改视频质量?
目前,我玩的是原始质量,我给出了像360p,480p,720p这样的改变质量的选项。
我怎样才能改变它?
发布于 2017-04-05 15:40:29
你不能简单地用AVplayer做到这一点。您需要不同的URL为不同质量的视频。当用户选择其他质量时,您可以使用AVPlayer的replaceCurrentItemWithPlayerItem方法切换到该视频。
AVPlayerItem *playeriem= [AVPlayerItem playerItemWithURL:urlOfSelectedQualityVideo];
[playeriem seekToTime:player.currentTime];
[player replaceCurrentItemWithPlayerItem:playeriem];发布于 2017-04-05 16:49:14
为了做像转换视频这样的事情,你应该使用FFmpeg库。尝试在github上查找一些使用ffmpeg的库。
就像这个:https://github.com/iMoreApps/ffmpeg-avplayer-for-ios-tvos
你不能用AVPlayer做到这一点。当只是流媒体时,你使用M3U索引文件,包含视频数据的TS文件,并只是切换流媒体。
看看苹果的HLS Documentation和播放列表Examples吧。
发布于 2017-11-07 18:35:48
您还可以创建多个m3u8格式,其中一个具有较低质量的视频比特率,例如128k到650k,另一个具有650k以上的较高比特率,并使用上面答案中建议的较高质量的流URL
AVPlayerItem *playeriem= [AVPlayerItem playerItemWithURL:urlOfSelectedQualityVideo];https://stackoverflow.com/questions/43224551
复制相似问题