I want to play a remote mp3 with AVPlayer. I can't make it work and I can't see the reason why it doesn't work. Code:
NSString *urlstr=@"..some link to a mp3"
NSURL *url=[NSURL URLWithString:urlstr];
self.player = [[[AVPlayer alloc] initWithURL:url] retain];
I have get a solution. Please try the following code:
NSString *urlstr=@"http://www.3rdeyelab.com/mp3/mp3/tailtoddle_lo.mp3" NSURL *url=[NSURL URLWithString:urlstr]; AVPlayerItem *playerItem = [AVPlayerItem playerItemWithURL:url]; player = [[AVPlayer playerWithPlayerItem:playerItem] retain]; [player play]; player.actionAtItemEnd = AVPlayerActionAtItemEndNone;
Hope it will work for you!!!