Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

Binju

macrumors member
Original poster
Jan 31, 2010
65
0
Is it possible to play a audio from the website(http://example/example.mp3)?

I tried the below code,but it is not working,


Code:
	NSURL *url  = @"http://example/example.mp3";
	
  

        NSError *error;
	audioPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:url error:&error];
	audioPlayer.numberOfLoops = -1;

	if (audioPlayer == nil)
		NSLog([error description]);
	else
		[audioPlayer play];
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.