Reputation: 2347
I've run into this numerous times now. Client send me some .mp3s to put in the project. When I try to play them using this code:
SKAction *play = [SKAction playSoundFileNamed:@"birds.mp3" waitForCompletion:NO];
[self runAction:play];
[self runAction:play];
The app gives me an exception and crashes on that line.
I took the mp3 and I converted it to .wav (in Reaper), change the code to load that, and no problem, plays perfect. I thought maybe the original mp3 had some encoding trouble, so I open it in Reaper, re-export is as a new mp3, still crash.
When it crashes, I look in the stack trace (I think I am using that right) and it shows this, which looks like it is having trouble with the ID3 maybe though? Reaper does encode mp3s using LAME, I don't know if it isn't compliant or something? Anyone run into this?
0x187321a98: b 0x187321a54 ; ID3ParserHandle::ID3ParserHandle(void*, int (*)(void*, unsigned int, unsigned int, unsigned int, void**, unsigned int*)) + 492
Upvotes: 1
Views: 399
Reputation: 64477
Things like that are relatively common. Some programs create non-standard audio files, while AVPlayer may have some problems with certain standard but uncommonly used file containers or features or compression format.
The easiest fix is to reencode the file using a different program. Audacity for example. In this case make sure to remove any ID3 tags (author, album name, etc) from the mp3 if the problem persists.
Upvotes: 1