7

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()
    }
Anton
  • 907
  • 1
  • 10
  • 31
  • I have other m3u8 streams working. Sometimes I find one that'll work on an iPhone 6 but not a 5S (same version of iOS), which is weird. What error are you getting with your other streams? – Graham Perks Nov 11 '15 at 16:12
  • Hello, I opened support ticket, Apple's support engineer said what streams have non-standard format, when I try to play it there is just black screen with crossed Play sign – Anton Nov 11 '15 at 17:07
  • tried Vitamio with DFVideoPlayer, there is performance issue on iPad Air and many streams cannot be played, but these streams work on android media player, is there alternative? – Anton Nov 12 '15 at 10:46
  • 1
    What was non-standard in the files you're trying to play? – Graham Perks Nov 12 '15 at 17:27
  • I think because these streams (not files) can be played in all other players and platforms, they confirm to some "standard", I am not expert in HLS. – Anton Nov 13 '15 at 19:07
  • First check ur video with: https://www.hlsplayer.net/.. pass url m3u8 url and play...check it stream playing or not – Anny Apr 06 '16 at 06:16

1 Answers1

2

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"

Anton
  • 907
  • 1
  • 10
  • 31
  • 2
    Note that NSAllowsArbitraryLoads doesn't fix this issue like it would for anything else. With AVPlayer, you have to add explicit exception domains to allow insecure HTTP video playback. – user3344977 Nov 24 '16 at 01:03