ios - how to use AVKit to playback the HTTP stream video -


   var url:nsurl! = nsurl(string: "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8")         var playitem:avplayeritem! = avplayeritem(url: url);         var player:avplayer! = avplayer(playeritem: playitem);          var playerlayer:avplayerlayer! = avplayerlayer(player: player);         self.view.layer.addsublayer(playerlayer);         player.play() 

when run these code, there crash, told me how use avkit playback video? thx ^ ^

try this:

//stream url     let movieurl:nsurl? = nsurl (string: "http://your url")     if let url = movieurl {       self.avplayer = avplayer(url: url)       self.avplayerviewcontroller.player = self.avplayer     }  //button action @ibaction func live(sender: uibutton) {       self.presentviewcontroller(self.avplayerviewcontroller, animated: true) { () -> void in         self.avplayerviewcontroller.player?.play()     } 

Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -