casatwy / CTVideoPlayerView

A video player view for iOS based on AVFoundation, better than PBJVideoPlayer, which can let you to play multiple video at the same time, and provide download, customized operation buttons, customized cover of video
Other
641 stars 81 forks source link

'Cannot remove an observer ... for the key path "player.currentItem.status" #22

Closed byroncoetsee closed 7 years ago

byroncoetsee commented 7 years ago

I'm getting the following error when closing the viewController containing the Player:

Terminating app due to uncaught exception 'NSRangeException', reason: 'Cannot remove an observer <CTVideoView 0x15f35dec0> for the key path "player.currentItem.status" from <CTVideoView 0x15f35dec0> because it is not registered as an observer.

The code I am using is as follows:

let videoUrlString = campaign.contentUrl?.stringByReplacingOccurrencesOfString("mpd", withString: "mp4")
let videoURL = NSURL(string: videoUrlString!)
player = CTVideoView(frame: CGRectMake(0, 0, viewContent.frame.width, viewContent.frame.height))
viewContent.addSubview(player)
player.assetToPlay = AVURLAsset(URL: videoURL!)
player.play()
casatwy commented 7 years ago

I have fixed this bug in 1.3.0, thank you for your issue!