Question

I'm trying to build a simple streaming application, and right now I'm feeding a direct link to a file (for example this one) to AVPlayer, using this simple code snippet:

_player = [AVPlayer playerWithURL:[NSURL  URLWithString:@"(file url here)"]];

[_player play];

However, it played nothing, so I tried 3rd-party components like The Amazing Audio Engine, and I got the following error:

AEAudioFileLoaderOperation.m:121: ExtAudioFileOpenURL result -43

As far as I understand, it cannot open a file via provided url. However, I tried opening the very same url in a browser, and it works perfectly (even on a device).

Where should I look for a source of this error? Also are there any alternatives to playing/serving an mp3 file for streaming?

Was it helpful?

Solution 2

Please disregard this question, I just realized that I had a silent mode turned on and actually everything worked just fine. In my defence, I should say that rocking volume buttons don't make any change, and you have to somehow turn off the silent mode in the first place.

OTHER TIPS

Try AVAudioPlayer. If your project has ARC enabled, then the player should not be declared as a local variable. It should be declared as a property. Otherwise, ARC will deallocate the player before it has a chance to play.

From Apple documentation: To create NSURL objects for file system paths, use fileURLWithPath:isDirectory: instead

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top