mercredi 15 juin 2016

Swift How to update url of video in AVPlayer when clicking on a button?


I have a video player in an IOS App and I want to update the video when I click on a button, but I do not see how to manage this. (Note : it's not a list of video within a queue)

Here is the code for adding the AVPlayer:

            let url = NSURL.fileURLWithPath(path)
            let player = AVPlayer(URL: url)
            let playerViewController = AVPlayerViewController()
            playerViewController.player = player
            ..

            ..
            self.ViewForVideo.addSubview(playerViewController.view)
            self.addChildViewController(playerViewController)

            player.play()

Aucun commentaire:

Enregistrer un commentaire