2

Xcode Version - 6.1.1, IOS Version on Device(IPHONE 4S) - 8.1.2

class ViewController2: UIViewController,AVAudioPlayerDelegate {
var player: AVPlayer! = nil
    override func viewDidLoad() {
        super.viewDidLoad()
        var steamingURL:NSURL! = NSURL(string:"http://yflvr.com:8080/data/songs1/mp3/16287239.mp3")
        player = AVPlayer(URL: steamingURL)
        player.play()
    }
}
Mega4alik
  • 597
  • 3
  • 10
  • 18

1 Answers1

5

Check the spelling of your filename. The device is case-sensitive, the simulator is not... Are you sure it is not just delayed?

Also, check if your ringer is off, you won't hear any sound when it's off. To prevent that, use

var session: AVAudioSession = AVAudioSession.sharedInstance();
            session.setCategory(AVAudioSessionCategoryPlayback, error: nil)

from here

You can also set an observer on the AVPlayer.status property to debug its changing status

Here they have used AVAudioPlayer and added a call to prepareToPlay()

Community
  • 1
  • 1
David Karlsson
  • 9,396
  • 9
  • 58
  • 103