I\'m trying to create an iOS/iPhone radio app using Xcode 4.5.2.
I wanted to stream @\"http://xx.xxxxxxx.com/8111/radio.m3u\" with play, pause, volume control and ab
There are Two way to achieve this.
Create a "MPMoviePlayerController *player" as a strong object in your ViewController.
So you code would look something like below:
@interface ViewController ()
{
UISlider *volumeSlider;
MPMoviePlayerController *player;
}
@end
- (IBAction)playButtonPressed;
{
NSString *urlAddress = @"http://xxxxxxx.com/8111/listen.m3u";
NSURL *url = [NSURL URLWithString:urlAddress];
if(nil != player)
{
player = nil; // Alternatively you can stop and restart with the different stream.
}
player = [[MPMoviePlayerController alloc]initWithContentURL:url];
player.movieSourceType = MPMovieSourceTypeStreaming;
[player prepareToPlay];
self.myPlayer = player;
[self.view addSubview:self.myPlayer.view];
[self.myPlayer play];
}