MPMusicPlayerController live streaming

799 views Asked by At

I am developing an application that plays a live HTTP web radio streaming (.pls, .mp3 ...). Can i use the MPMusicPlayerController to play the stream ? Thaks.

1

There are 1 answers

3
Puneet Sharma On BEST ANSWER

I don't think you can play streaming audio using MPMusicPlayerController. You should look at AVPlayer.

NSURL *url = [NSURL URLWithString:url];    
AVURLAsset *asset = [AVURLAsset URLAssetWithURL:url options:nil];    
AVPlayerItem *playerItem = [AVPlayerItem playerItemWithAsset:asset];    
AVPlayer *audioPlayer = [AVPlayer playerWithPlayerItem:playerItem];    
[audioPlayer play];