如何让播放器从最新帧恢复?
How to make player resume from the newest frame?
我使用 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()
继续播放。实时视频然后从暂停的帧播放,我想要的是从最新或最新的帧恢复视频。
您可以释放播放器,然后重新启动它。这应该从最新的帧播放演示。这可能不是最好的解决方案。
我使用 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()
继续播放。实时视频然后从暂停的帧播放,我想要的是从最新或最新的帧恢复视频。
您可以释放播放器,然后重新启动它。这应该从最新的帧播放演示。这可能不是最好的解决方案。