Moein Hosseini
Moein Hosseini

Reputation: 4383

play pls file in browser

I need to play a pls file in my website, so that each user can listen to it. One way is to use Flash and actionscript, but I've been searching for another way to play it in the browser using JavaScript or HTML5.

Is there a way to play pls files in the browser using html5 or javascript?

Upvotes: 0

Views: 1491

Answers (1)

cuzzea
cuzzea

Reputation: 1535

A pls file has this format:

[playlist]
NumberOfEntries=x
File1=http://80.86.106.136:80/
File2=http://80.86.106.136:80/
...

so you would need to read the content and do something like this

var content = readPls();
var data = content.split('\n\r');
var number_of_files = data[1].replace('NumberOfEntries=','');
var files = [];
for(var i=0;i<number_of_files;i++){
    files.push(data[2+i].replace("File"+(i+1),''))
}

code needs work, but this is the way to go about it (in js/as)

Upvotes: 1

Related Questions