all groups > flash actionscript > march 2004 >
You're in the

flash actionscript

group:

Streaming mp3s will not play


Streaming mp3s will not play Telescreen
3/12/2004 10:01:33 PM
flash actionscript:
I'm trying to get streaming audio to work within my flash movie. The code I
wrote works when using the local version 6 flash player, but when I open the
flash movie in an activex container ie. Internet Explorer, the streaming audio
does not work. I have the latest version activex flash player 7, I believe
it's version 7.0.19.

The code looks like this:
sPlayer = new Sound();
sPlayer.loadSound(_root.musicurl,true); //_root.musicurl = mp3stream
example http://localhost:80
sPlayer.start();



Re: Streaming mp3s will not play jameslyon
3/12/2004 10:42:53 PM
Re: Streaming mp3s will not play Jack.
3/12/2004 11:01:31 PM
try -
musicurl ="myfolder/the.mp3";
or
musicurl ="http..full web address/the.mp3";

sPlayer = new Sound(this);
sPlayer.loadSound(musicurl,true);
//sPlayer.start(); // not needed when streaming = true

Re: Streaming mp3s will not play Telescreen
3/12/2004 11:24:53 PM
I tried changing my code, but it did not work. I have been reading up on the
problem a little more, and I think it's because I'm trying to play shoutcast
streams. I think it might have something to do with the header information
that shoutcast sends. I'm running flash within a visual basic program though
and I'm buffering the stream through this application so this will allow me to
manipulate whatever headers that flash doesn't like. I just need to know which
headers flash will except and the exact reason why flash will not play
shoutcast streams. I'm already parsing the .pls file so I have the stream
locations.


Re: Streaming mp3s will not play Jack.
3/12/2004 11:54:36 PM
[quoted text, click to view]
do with the header information that shoutcast sends

i tested with -

pls =
"http://www.shoutcast.com/sbin/shoutcast-playlist.pls?rn=5241&file=filename.pls"
;

lv = new LoadVars();
lv.onLoad = function(){
trace(unescape(lv));
};
lv.load(pls);

this outputs the .pls as -
[playlist]
numberofentries=3
File1=http://radiost.sc.llnwd.net:12545
Title1=(#1 - 183/548) Radiostorm.com: CLASSIC ROCK
Length1=-1
<snip>

using the url - radiost.sc.llnwd.net:12545 - in the browser gets you -
SHOUTcast Administrator
SHOUTcast D.N.A.S. Status

as the stream location did not provide a path to the mp3,
it does not appear possible from this simple test :(
Re: Streaming mp3s will not play gunofason
3/13/2005 9:48:04 PM
this is how i parse pls files with just actionscript.




//XML is our bitch to load in a plain file.
xObj = new XML();
xObj.load("ilovemichelle.pls");
//after you preload this file then execute this code.
// where the file names will be stored
plsFiles_array = [];
// where the title names will be stored
plsTitles_array = [];
// reads in the pls file as a single node
pls = xObj.firstChild.nodeValue;
// make sure its a String.
pls.toString();
// parsing via String. So we abandon XML slowness from this point on.
// converts each new line of the file to an array element
// pls files are not all written the same. this conditional
// checks to see how lines were written.
if (pls.indexOf("\r\n")>-1) {
pls_array = pls.split("\r\n");
} else {
pls_array = pls.split("\n");
}
// loop thru array.
for (i=0; i<pls_array.length; i++) {
// parse line by line
fileLook = pls_array[i];
// look for the word 'File' which will denote, get this, a file!
if (fileLook.indexOf("File", 0) != -1) {
// push file names into an Array.
// the name of the file starts after the equal sign.
// fileLook.indexOf("=")+1
// the name of the file ends at the end of the line.
// fileLook.length()
plsFiles_array.push(fileLook.substring(fileLook.indexOf("=")+1,
fileLook.length()));
// this stores title names in the plsTitles_array
} else if (fileLook.indexOf("Title", 0) != -1) {
plsTitles_array.push(fileLook.substring(fileLook.indexOf("=")+1,
fileLook.length()));
}
}
AddThis Social Bookmark Button