danu
danu

Reputation: 1178

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

Working on a project in swift, where I'm trying to initiate the AVPlayer, and for some reason it trows me an exception saying

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

I guess the issue is with my URL. Here is my code

func initPlayer() {
    let url:NSURL = NSURL(string:"https://purelight1-163000.appspot.com/api/user/v2/media/track/60/sample")!
    self.playerItem = 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)
}

Upvotes: 22

Views: 12296

Answers (3)

Luchi Parejo Alcazar
Luchi Parejo Alcazar

Reputation: 151

That issue happens because of the simulator.

I had the same issue with the iPhone 14 simulator and I solved it selecting System as audio output and tapping on Device --> Erase All Content And Settings...

Upvotes: 0

spasbil
spasbil

Reputation: 279

For me it was because of the Simulator's audio output.

I was using an audio capture app iShowU for different project with headphones setup. But to disable the simulator's audio only I set that "Audio Device Output" to the iShowU setup with the headphones (which weren't plugged in). It finished playing the video that was loaded and then that problem appeared.

Switching the audio output from Simulator > I/O > Audio Output to the System one and rerunning my build resolved my issue.

Upvotes: 4

Jeroen
Jeroen

Reputation: 53

Xcode is overly chatty. You just need edit your Scheme (Product > Scheme > Edit Scheme) and create a new Environment Variable OS_ACTIVITY_MODE and set its value to disable.

Upvotes: -2

Related Questions