2016-08-31 2 views
0
내가 DecryptAudioPlayer라는 클래스를 만들

, 그것은 NSObject를 상속 작동하지,이 클래스는 AVPlayer를가 refrenced, 아래 init.like 때 통지 AVPlayerItemDidPlayToEndTimeNotification을 준수신속 AVPlayerItemDidPlayToEndTimeNotification

override init() { 
    super.init() 
    NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(self.playToEnd(_:)), name: AVPlayerItemDidPlayToEndTimeNotification, object: nil) 
} 

나는 방법이 있습니다

func playToEnd(notification:NSNotification) { 
    Log.printLog("notification:\(notification)") 
} 

하지만 때로는 플레이어의 심고가 AVPlayerItemDidPlayToEndTimeNotification recived 수 없다, 나는 매우 confused.it 누가 캘리포니아의 AVPlayerItem이 AVPlayerItemDidPlayToEndTimeNotification의 종료 시간을 게시하지 않습니다 수 있습니다 보인다 왜 그런지 말해줘?

+0

플레이어를 초기화 한 후 옵저버를 추가하고 있습니까? – pkc456

+0

물론 플레이어는 DecryptAudioPlayer가 빚지고 있습니다. 나는 관측 대상을 빚진 것에 추가합니다. – czjeep

+0

알림 개체에서 플레이어의 currentItem을 추가하십시오. –

답변

0

문제를 해결하기 위해 지연된 알림이 표시 될 수 있습니다. 그래서 질문은 잠시 동안 내려 질 수 있습니다.