Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to retrieve Shoutcast .pls stream

I'm trying to get a .pls stream from a shoutcast server to play in my ios app. So far i've been unsuccessful. I've red a lot of posts on stackoverflow but non of these were of any help.

Can anyone please explain to me, if its even possible, how to get .pls to stream?

like image 349
Roeliee Avatar asked Jan 14 '23 23:01

Roeliee


2 Answers

all you need is to list the port of you radio, here is one working example: in - (void)viewDidLoad

NSURL *vibes = [NSURL URLWithString:@"http://website.com:8002"];
vPlayer = [[AVPlayer alloc] initWithURL:vibes];
self.myViewVolume = [[MPVolumeView alloc] initWithFrame:CGRectMake(20, 330, 280, 50)];
[self.myViewVolume sizeToFit];
[self.view addSubview:self.myViewVolume];

you need to create an instance of AVPlayer in your .m file , here it is vPlayer do not forget to add AVFoundation framework to you project, you can play and stop the stream with [player play] and [player stop]

One problem with AVPlayer is the lack of easy volume control, you can add one with mpViewVolume. I am also working on radio app and by far AVPlayer is the best to play shoutcast streams.

like image 75
EmilDo Avatar answered Jan 22 '23 11:01

EmilDo


@Walid Hussain it worked for me using AVPlayer

link with AVFoundation.framework

//import needed
#import <AVFoundation/AVFoundation.h>

// declaration for the player  
AVPlayer * radioPlayer;

// play
NSURL * url = [NSURL URLWithString:@"http://energy10.egihosting.com:9636"];
radioPlayer = [[AVPlayer playerWithURL:url] retain];
[radioPlayer play];
like image 20
Ammarz Avatar answered Jan 22 '23 10:01

Ammarz