3
비디오를 재생 한 후 내 비디오 플레이어를 닫으려고합니다.비디오 플레이어 닫기 비디오가 재생 된 경우 하위보기 빠른 iOS
func playVideoPepper() {
var maxVideoCount:Int = 5 //AnzahlderVideos
var Random = Int(arc4random_uniform(maxVideoCount + 0))
var VideoNumber = Random + 1
let path = NSBundle.mainBundle().pathForResource("pepper\(VideoNumber)", ofType:"mp4")
let url = NSURL.fileURLWithPath(path!)
moviePlayer = MPMoviePlayerController(contentURL: url)
if let player = moviePlayer {
player.view.frame = self.view.bounds
player.prepareToPlay()
player.scalingMode = .AspectFill
player.controlStyle = .None
self.view.addSubview(player.view)
var time = player.duration
println(time)
}
}
나는 .duration 또는 .playableduration와 비디오의 긴 하나 (5 개 비디오에 무작위로 재생하는 경우) 시간을 얻기 위해 시도했지만 모두는 서브 뷰가 될 수 있도록 할 수있는 쉬운 방법이 나에게 0.00를 제공 동영상이 재생되면 삭제 되나요?
"Notificaitons"등을 구독하는 방법을 모르겠다. sm 내 딸을위한 모든 프로젝트 (학습자로부터) : –
'NSNotificationCenter.defaultCenter(). addObserver (self, selector : Selector ("playerDidFinish :"), 이름 : MPMoviePlayerPlaybackDidFinishNotification, object : player)를 사용하여 알림을 구독 할 수 있습니다. 이것은'viewWillAppear' 메소드에서 수행되어야하고'viewWillDisappear' 메소드에서 컨트롤러'NSNotificationCenter.defaultCenter(). removeObserver (self)'를 제거해야합니다 –
이것을 게시물로 추가 할 수 있습니까 :)? 나는 그것을 투표하고 싶고 다른 사람들에게 위대한 도움이 될 것입니다. 단지 코멘트가 아닌 것입니다. –