Usamos cookies para medir audiência e melhorar sua experiência. Você pode aceitar ou recusar a qualquer momento. Veja sobre o iMasters.
Pessoal
Estou criando um player em flash para um site de radio online, consigo rodar o stream, mas não estou conseguindo trazer as informações das musicas que estão sendo tocadas.
Estou usando o xml gerado automaticamente pelo shoutcast.
Tentei usar o ID3 mas não consegui, li um outro tópico aqui relacionado ao ID3 com shoutcast, mas pelo que vi tb não houve solução.
Segue abaixo o codigo para analise e possivel ajuda de todos.
Sempre aparece como undefined.
function stream()
{
System.security.allowDomain("[http://dominio:7020"](http://dominio:7020));
myRadio = new String("[http://dominio:7020/;"](http://dominio:7020/;));
mySound = new Sound();
mySound.loadSound(myRadio, true);
mySound.start();
}
function clearBuffer() mySound.stop();
delete mySound;
stream();
}
timerinProgress = false;
musicOn = true;
offonText = "OFF";
System.security.allowDomain("[http://dominio:7020"](http://dominio:7020));
myRadio = new String("[http://dominio:7020/;"](http://dominio:7020/;));
mySound = new Sound();
mySound.loadSound(myRadio, true);
mySound.start();
var vol = 80;
_root.onEnterFrame = function () _root.mySound.setVolume(vol);
};
var intervalID = setInterval(clearBuffer, 1200000);
if(ligado==null) {
i = 0;
vol = 100;
ligado = false;
}
this.onEnterFrame = function () {
mySound.setVolume(vol);
}
if(ligado==false) {
mySound.loadSound(myRadio, true);
if(i<2)
i++;
else
i = 0;
ligado=true;
}
//tentando pegar informações atraves do ID3
//artista.text = "Artista: " + _root.mySound.id3.artist;
//musica.text = "Musica: " + _root_mySound.id3.songname;
verifica = mySound.getVolume();
if(verifica>=100) {
mySound.setVolume(100);
}
if(verifica<=0) {
mySound.setVolume(0);
}
v3.text = mySound.getVolume() + "%";
mySound.onSoundComplete = function() {
ligado = false;
}
//aumenta volume
v1.onRelease = function() {
verifica = mySound.getVolume();
vol = verifica+5;
}
//diminui volume
v2.onRelease = function() {
verifica = mySound.getVolume()
vol = verifica-5;
}
//parar música
parar.onRelease = function() {
acao = "stop"
mySound.stop();
}
//pause música
pause.onRelease = function() {
acao = "pause";
pos = mySound.position/1000;
mySound.stop();
}
tocar.onRelease = function() {
if(acao=="pause") {
mySound.start(pos);
acao="";
} else {
mySound.start();
}
}
passar.onRelease = function() {
ligado = next;
mySound.start();
}
//Buscar informações do xml
function loadXML(loaded) {
System.security.allowDomain("[http://dominio:7020"](http://dominio:7020));
if (loaded) {
_root.songtitle= this.firstChild.childNodes[8].firstChild.nodeValue;
_root.dj = this.firstChild.childNodes[7].firstChild.nodeValue;
musica.text = "MUSICA: " + _root.songtitle;
artista.text="DJ: " + _root.dj;
} else {
trace("Servidor não localizado");
}
}
System.useCodepage = true;
var meuXML:XML = new XML();
meuXML.ignoreWhite = true;
meuXML.addRequestHeader("User-Agent","Mozilla");
meuXML.load("[http://dominio:7020/admin.cgi?pass=senha&mode=viewxml"](http://dominio:7020/admin.cgi?pass=senha&mode=viewxml));
//trace(this.firstChild);Carregando comentários...