Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Playing HLS m3u8 on iOS 9

I have a problem with playing video streams HLS m3u8. I created a new project with target iOS9 and use AVPlayer to plat video stream. While test stream is working, all other video streams which I use in my windows and android app do not work with iOS AVPlayer class. Could you please give advise is it possible to tune AVPlayer or which 3rd party modern library can be used? Update: Tried demo app of Vitamio, it works.

This is code which I use:

    @IBAction func pressed(sender: AnyObject) {
// this url work, all others not
        let url = NSURL(string:"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8")
        let player = AVPlayer(URL: url!)
        let playerController = AVPlayerViewController()

        playerController.player = player
        self.addChildViewController(playerController)
        self.myView.addSubview(playerController.view)
        playerController.view.frame = self.myView.frame

        player.play()
    }
like image 948
Anton Avatar asked Nov 11 '15 10:11

Anton


1 Answers

this problem was resolved, from Apple Support:

"App Transport Security has blocked a cleartext HTTP resource load since it is insecure. Temporary exceptions can be configured via your app's Info.plist file

We would recommend going through sessions 706, 711 from WWDC 2015 for more details. Going through NSAppTransportSecurity developer resource is also recommended"

like image 185
Anton Avatar answered Sep 21 '22 10:09

Anton