1.PodFile 文件增加
pod 'KTVHTTPCache', '~> 2.0.0'
2.在終端 需要先cd到podfile文件所在目錄 執行pod install
3.在header.h 頭文件中引入
#import <KTVHTTPCache/KTVHTTPCache.h>
4.在AppDelegate 初始化ktvhttpcache
try? KTVHTTPCache.proxyStart()
5.使用
let playerUrl = KTVHTTPCache.proxyURL(withOriginalURL:URL.init(String:"音視頻地址"))
返回的URL類型,直接扔給播放器就可以這里使用avplayer
AVPlayer.init(playerItem:AVPlayerItem.init(url: playerUrl))