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

3

22

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)
}
Kubis answered 29/11, 2017 at 11:56 Comment(5)
This has something to do with the simulator, I think. I am not getting the errors on a real device.Envisage
Unrelated, but why create an NSURL and then cast it to URL? You should just simply do let url= URL(string:"https://purelight1-163000.appspot.com/api/user/v2/media/track/60/sample")!Teleview
Do you happen to have a breakpoint set for All Exceptions? The solution for me was to set this to only catch Objective-C exceptions and not C++ ones by editing the breakpoint.Smoko
yes break points set for All Exceptions sir. however technically it should not crashKubis
I ended up here looking for a different error, but the message was the same no device with given ID. This seems to only happen to me when I'm using the Simulator as @Envisage said. I was able to get it to stop by selecting my Simulator window, then going to Hardware -> Audio Output and changing it off of the system default (Note: this might still be the same output source)Wachter
I
4

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.

Introject answered 3/9, 2020 at 15:37 Comment(0)
T
0

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...

Thedrick answered 31/8, 2023 at 13:22 Comment(0)
M
-2

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.

Mawkin answered 6/2, 2018 at 14:54 Comment(3)
I'm not sure this approach is ideal. Won't this silence other important (or at least potentially important) warnings?Savoirfaire
@AmitaiB This answer is not meant to solve the problem, just to stop the console from writing so many lines. Useful if you want to see only your print outputsGeisha
I would advise against any of my developers doing this. This also suppresses constraint violations.Hesiod

© 2022 - 2024 — McMap. All rights reserved.