Nicos Karalis
Nicos Karalis

Reputation: 3773

AVPlayer not playing on iOS 9

I'm trying to build a audio streaming app, like a radio. This is the URL of the stream: http://radio.livesh.com.br:8068/

This is basically how I do:

player = AVPlayer()
let playerItem = AVPlayerItem( URL:NSURL(string:streamURL)! )
player = AVPlayer(playerItem:playerItem)
player.rate = 1.0;
player.play()

The player var is stored so it does keep playing and is not being deinit'ed. In an iPhone 5S with iOS 8 it works and I can hear the sounds. In an iPhone 6 with iOS 9 it doesn't.

What am I doing wrong?

Upvotes: 2

Views: 1269

Answers (1)

user1328775
user1328775

Reputation:

could be the ATS (app transport security) which enforces usage of https instead of http

you can either serve your content over https or create an exception on the info.plist file as such:

<key>NSAppTransportSecurity</key>
<dict>
  <key>NSExceptionDomains</key>
  <dict>
    <key>radio.livesh.com.br</key>
    <dict>
      <key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
      <true/>
    </dict>
  </dict>
</dict>

Upvotes: 3

Related Questions