I'm trying to create a radio app that gets audio from Shoutcast or Icecast. I've been able to play music from a http url that ends in mp3 (ex: https://soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3). I can not stream from a url like this (ex: http://hydra.shoutca.st:8057/autodj). There has to be something that I'm missing.
import UIKit
import AVFoundation
class ViewController: UIViewController {
var player: AVPlayer!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
//https://soundhelix.com/examples/mp3/SoundHelix-Song-1.mp3 - this works
let url = URL(string: "http://edge2-b.exa.live365.net/a36007")
player = AVPlayer(url: url!)
}
@IBAction func playButtonPressed(_ sender: Any) {
player.play()
}
@IBAction func stopButtonPressed(_ sender: Any) {
player.pause()
}
}