Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I have experienced the same thing with this 3rd party app and could not find a solution for that and then I have tried apple's native avplayer (not avaudioplayer) which gives you the ability to stream with the function <code>:initWithURL</code> . here's the class reference, by the way : <a href="http://developer.apple.com/library/mac/#documentation/AVFoundation/Reference/AVPlayer_Class/Reference/Reference.html" rel="noreferrer">http://developer.apple.com/library/mac/#documentation/AVFoundation/Reference/AVPlayer_Class/Reference/Reference.html</a></p> <p>in addition here's my code for playing music : </p> <pre><code>NSURL *url = [[NSURL alloc] initWithString:sourceURL]; theItem = [AVPlayerItem playerItemWithURL:url]; theItem addObserver:self forKeyPath:@"status" options:0 context:nil]; theAudio = [AVPlayer playerWithPlayerItem:mainDelegate.theItem]; </code></pre> <p>to catch whether the player is readyto play you add the observer above and then you can check it like : </p> <pre><code>- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if (object == theItem &amp;&amp; [keyPath isEqualToString:@"status"]) { if(theItem.status == AVPlayerStatusReadyToPlay) { [theAudio play]; [theItem removeObserver:self forKeyPath:@"status"]; } else if(theItem.status == AVPlayerStatusFailed) { NSLog(@"%@" , mainDelegate.theItem.error.description); } else if(theItem.status == AVPlayerStatusUnknown) NSLog(@"unknown"); } } </code></pre> <p>I hope this helps.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload