我使用piemonte / Player在我的应用中显示视频,但我在控制台中发现错误:
2015-11-15 17:58:30.238 summonerMenu [5361:200890] 17:58:30.238错误:177:在0.012秒(180 180)之后超时; mMajorChangePending = 0
2015-11-15 17:58:43.652 summonerMenu [5361:200891] 17:58:43.651错误:177:在0.012s之后超时(1331 1332); mMajorChangePending = 0
2015-11-15 17:58:48.789 summonerMenu [5361:200891] 17:58:48.789错误:177:在0.012s(1773 1774)之后超时; mMajorChangePending = 0
我的Xcode是7.1 iOS 9
这是我的代码:
let videoUrl = NSURL(string: "http://cdn.leagueoflegends.com/champion-abilities/videos/mp4/0067_05.mp4")!
class PlayerViewController: UIViewController, PlayerDelegate {
private var player: Player!
// MARK: object lifecycle
convenience init() {
self.init(nibName: nil, bundle:nil)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: NSBundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
}
// MARK: view lifecycle
override func viewDidLoad() {
super.viewDidLoad()
self.view.autoresizingMask = ([UIViewAutoresizing.FlexibleWidth, UIViewAutoresizing.FlexibleHeight])
self.player = Player()
self.player.delegate = self
self.player.view.frame = CGRect(x: 0, y: 0, width: 414, height: 300)
self.addChildViewController(self.player)
self.view.addSubview(self.player.view)
self.player.didMoveToParentViewController(self)
self.player.setUrl(videoUrl)
self.player.playbackLoops = true
let tapGestureRecognizer: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: "handleTapGestureRecognizer:")
tapGestureRecognizer.numberOfTapsRequired = 1
self.player.view.addGestureRecognizer(tapGestureRecognizer)
}
override func viewDidAppear(animated: Bool) {
super.viewDidAppear(animated)
self.player.playFromBeginning()
}
// MARK: UIGestureRecognizer
func handleTapGestureRecognizer(gestureRecognizer: UITapGestureRecognizer) {
switch (self.player.playbackState.rawValue) {
case PlaybackState.Stopped.rawValue:
self.player.playFromBeginning()
case PlaybackState.Paused.rawValue:
self.player.playFromCurrentTime()
case PlaybackState.Playing.rawValue:
self.player.pause()
case PlaybackState.Failed.rawValue:
self.player.pause()
default:
self.player.pause()
}
}
// MARK: PlayerDelegate
func playerReady(player: Player) {
}
func playerPlaybackStateDidChange(player: Player) {
}
func playerBufferingStateDidChange(player: Player) {
}
func playerPlaybackWillStartFromBeginning(player: Player) {
}
func playerPlaybackDidEnd(player: Player) {
}
}