3

I'm trying to initialize my AVPlayer as to stream an URL, and my app crashes when it's loading even before I click my play button. Thus it throws me an error saying

"AudioHardware.cpp:1200:AudioObjectRemovePropertyListener: AudioObjectRemovePropertyListener: no object with given ID 0".

My code as below. Any help would much appreciate, as for me to stream an URL.

func initPlayer() {
    let url:NSURL = NSURL(string:"https://purelight1-163000.appspot.com/api/user/v2/media/track/60/sample")!
    if player != nil {
    self.player?.replaceCurrentItem(with: AVPlayerItem(url: url as URL))

    self.player=AVPlayer(playerItem: self.playerItem!)
    let playerLayer=AVPlayerLayer(player: self.player!)
    playerLayer.frame = CGRect(x: 0, y: 0, width: 10, height: 50) // actually this player layer is not visible
    self.view.layer.addSublayer(playerLayer)
    }
}
Faysal Ahmed
  • 7,501
  • 5
  • 28
  • 50
danu
  • 1,079
  • 5
  • 16
  • 48

0 Answers0