Varun
Varun

Reputation: 31

How to play a .pls file in iOS?

I am trying to develop a radio application for iOS. I want to play the .pls files. I tried using AVPlayer but to no success. I retreived the URL from .pls. That also does not run. The stream however runs if I open the .pls file using the UIWebView.

Is there anything I can do to play it natively rather than using webview?

PLS link : http://66.23.234.242:8012/listen.pls

Upvotes: 0

Views: 5770

Answers (2)

Yuvaraj M
Yuvaraj M

Reputation: 340

using MPMoviePlayer we can play .pls file and you have to hide that MPMoviePlayer, it look like a audio player and add subview to your view.

moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL URLWithString: @"your .pls link"]];
[moviePlayer.moviePlayer prepareToPlay];
moviePlayer.view.hidden = YES;
[self.view addSubview:moviePlayer.view];

//for play:

[moviePlayer.moviePlayer play];

//for pause:

[moviePlayer.moviePlayer stop];

Upvotes: 1

DevCali
DevCali

Reputation: 398

Check out this link https://discussions.apple.com/thread/1924391?start=0&tstart=0

PLS is a computer file format that stores multimedia playlists. It is a more expressive format than basic M3U, as it can store (cache) information on the song title and length — extended M3U supports this, too. With PLS version 2, playlists also include a PLS version declaration.

To play these files you need a media player on your operating system that is able to play these files. One of these media players is iTunes. "Copied from the above mentioned link"

Upvotes: 1

Related Questions