1

I am having an issue with Spotify preview links, they are not playing using AVPlayer.

    var aSongURL: String = String(format: "https://p.scdn.co/mp3-preview/2d933f6474345c8af7e164356f30f450d0fc1309?cid=5e9ac4fc700442599e05f987a9cb1d4a")
    var aPlayerItem: AVPlayerItem = AVPlayerItem(url: NSURL(string: aSongURL)! as URL)
    var anAudioStreamer: AVPlayer = AVPlayer(playerItem: aPlayerItem)
    anAudioStreamer.play()

It's a MP3, why is it not supported by AVPlayer, any ideas?

Remco Beugels
  • 1,153
  • 1
  • 12
  • 21
Kodr.F
  • 13,932
  • 13
  • 46
  • 91

1 Answers1

1

Try the method described here. It worked for me for your URL.

Mahesh De Silva
  • 505
  • 8
  • 20
  • i've already tried it , its not playing this url by Spotify `"https://p.scdn.co/mp3-preview/2d933f6474345c8af7e164356f30f450d0fc1309?cid=5e9ac4fc700442599e05f987a9cb1d4a"` wired – Kodr.F Nov 14 '17 at 11:13
  • Have you enabled App Transport Security(ATS) in your info.plist file? I tried playing that exact URL, and it worked for me. – Mahesh De Silva Nov 14 '17 at 11:40
  • not working i got this error `CredStore - performQuery - Error copying matching creds. Error=-25300, query={ class = inet; "m_Limit" = "m_LimitAll"; "r_Attributes" = 1; sync = syna; }` – Kodr.F Nov 14 '17 at 12:50