2016-12-01 4 views
0

이 코드를 사용하여 비디오 작업을 마쳤습니다.AVPlayer m3u8 비디오 끝 문제

NotificationCenter.default.addObserver(self, selector: #selector(stopedPlaying), name: NSNotification.Name.AVPlayerItemDidPlayToEndTime, object: nil) 

이것은 mp4 비디오로 작업하고있었습니다. 하지만 그들은 10 분 이상이므로 m3u8 형식을 사용하기 시작합니다. 그러나이 코드 부분은 더 이상 작동하지 않습니다. 어떤 아이디어라도 감사 할 것입니다.

답변

0

변경 사항을 관찰해야하는 개체를 추가해야합니다. 아래 코드와 같이 playerItem 개체를 추가하십시오.

NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(stopedPlaying), 
    name: AVPlayerItemDidPlayToEndTimeNotification, 
    object: destination.player!.currentItem) 
+0

죄송합니다. 그러나 객체를 추가하는 경우에도 마찬가지입니다. 그리고 제가 언급했듯이, 그것은 mp4로 작업하고 있습니다. – cvdogan

+0

m3u8 스트리밍으로 저를 위해 일하고 있습니다. 좀 더 많은 코드를 공유 할 수 있습니까? – abhi1992