我使用ijkplayer在我的 ios 应用程序中播放实时视频。
这是播放器初始化的代码
let options = IJKFFOptions.byDefault()
let streamUrl:String = "http://xxxxxxxxx.com/test/7777.flv"
let player = IJKFFMoviePlayerController(contentURLString: streamUrl, with: options)
let autoresize = UIViewAutoresizing.flexibleWidth.rawValue | UIViewAutoresizing.flexibleHeight.rawValue
player?.view.autoresizingMask = UIViewAutoresizing(rawValue: autoresize)
player?.view.frame = CGRect(x: 0, y: 0, width: 1, height: 1)
let gesture = UITapGestureRecognizer(target: self, action: #selector(self.compressExpand(_:)))
player?.view.addGestureRecognizer(gesture)
player?.view.backgroundColor = UIColor.black
player?.scalingMode = .aspectFit
player?.shouldAutoplay = false
self.player = player
self.player.shouldShowHudView = true
self.player.setPlayerOptionIntValue(1000, forKey: "max_cached_duration")
问题是我player.pause()
用来恢复播放器一段时间。然后我player.play()
用来恢复播放。然后从暂停的帧播放实时视频,我想要的是从最新或最新的帧恢复视频。