Comunidad de diseño web y desarrollo en internet online

Reproductor swf, con lista xml, en streaming !

Citar            
MensajeEscrito el 29 Sep 2010 08:24 pm
hola amigos ! de cristallab !
acá va mi primera consulta :::

en una pagina tengo tres playlist, d tres discos diferentes.
el nombre de las canciones se ve gracias la lista xml
canciones.xml
tiene stop, play, rewind, foward.
funciona muy bien. ! creo.. por ahora.
Faltaría el streaming, el porcentaje de lo cargado,((( pero que se pueda ir escuchando mientras tanto !)))
ya que cuando lo subo, se queda en silencio un buen rato
y nadie sabe que pasa , por más que haya puesto
play a uno de los playlist !

acá va el codigo de action script

Código :

[as]var cancion_actual:Number=1
cancion=new Sound()

System.useCodepage=true
var canciones_xml:XML = new XML();
canciones_xml.ignoreWhite=true
canciones_xml.onLoad = function() {

   
   
   cargar_cancion(reproducir)

   

};

canciones_xml.load("canciones.xml");

cargar_cancion = function(reproducir) {

   nombre_cancion = canciones_xml.childNodes[0].childNodes[cancion_actual-1].childNodes[1]
   titulo_cancion.txt_titulo.anim_titulo.titulo_cancion.htmlText=nombre_cancion;
   cancion.loadSound(cancion_actual+".mp3",true)


}

cancion.onSoundComplete = function (){

boton_siguiente.onRelease();

}

boton_siguiente.onRelease=function() {
   cancion_actual++
   if(cancion_actual<=7) {
      cancion.stop()
      cancion.start()
      cargar_cancion(cancion_actual)
   } else {
      cancion_actual=1
      cargar_cancion(cancion_actual)
   }

};

boton_atras.onRelease=function() {
   cancion_actual--
   if(cancion_actual>=1) {
      cancion.stop()
      cancion.start()
      cargar_cancion(cancion_actual)
   } else {
      cancion_actual=7
      cargar_cancion(cancion_actual)
   }

};

boton_stop.onRelease=function(){
   boton_atras.enabled=false
   boton_siguiente.enabled=false
   titulo_cancion.txt_titulo.anim_titulo.titulo_cancion.htmlText="play para escuchar";
   cancion.stop()
}

boton_play.onRelease=function(){
   boton_atras.enabled=true
   boton_siguiente.enabled=true
   cancion_actual=1
   cargar_cancion(cancion_actual)
}[/as]







me podrían ayudar por favor?
muchas gracias
mundi

Por mundis

5 de clabLevel



 

safari
Citar            
MensajeEscrito el 29 Sep 2010 08:37 pm
El parámetro de streaming lo tienes a true

cancion.loadSound(cancion_actual+".mp3",true)

Si tarda en reproducir será porque la conexión es lenta.
Para preload lo haces como harías un preload de un swf, ya que el objeto Sound tiene las propiedades getBytesLoaded() y getBytesTotal()

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 30 Sep 2010 04:12 pm
gracias el finde lo veo mejor ! y veo si sale !! gracias
por lo rpnto

cancion.onSoundComplete = function (){

veo que aqui me dice
esto, pero el porcentaje como le agrego?

mis conocimientos son flojos. pero estudio en estos días
para ver como lo hago.
digo si ay tiene stream , le quiero agregar el porcentaje, para que la gente
sepa que algo se esta cargando
beso

Por mundis

5 de clabLevel



 

safari
Citar            
MensajeEscrito el 30 Sep 2010 04:18 pm
Estudia el finde, luego ya sigues preguntando

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 01 Oct 2010 07:05 pm
JOrge !

este codigo use para un swf que carga una canción !
intente se lo agregue al playlist d ahora y no funciona. es que ahora son 20 canciones.


Código ActionScript :

stop();
function cargar_mp3(mp3) {
   cancion = new Sound();
   cancion.loadSound(mp3, true);
   this.onEnterFrame = function() {
      BytesLoaded = cancion.getBytesLoaded();
      BytesTotal = cancion.getBytesTotal();
      porcentaje = Math.floor(BytesLoaded/BytesTotal*100);
      if (!isNaN(porcentaje)) {
         estado.text = porcentaje+"%";
      }
   };
   cancion.onLoad = function() {
      delete onEnterFrame;
      estado.text = " ";
   };
}
cargar_mp3("http://www.lineazompa.com.ar/1_salvetti.mp3");
b_pause.onRelease = function() {
   ultimaPosicion = Math.round(cancion.position/1000);
   cancion.stop();
};
b_stop.onRelease = function() {
   ultimaPosicion = 0;
   cancion.stop();
};
b_play.onRelease = function() {
   if (ultimaPosicion == 0) {
      cancion.start();
   } else {
      cancion.start(ultimaPosicion);
   }
};


este código uso para cargar mis peliculas !
estuve viendo pero me cuesta entender , como agrgarle porcentaje para cada cancion

Código ActionScript :

function cargando() {
var total, cargados, porcentaje;
total = _root.getBytesTotal();
cargados = _root.getBytesLoaded();
porcentaje = Math.floor((cargados*100)/total);
porcentaje_txt.text = porcentaje + " %";
barra_mc.gotoAndStop(porcentaje);
if (cargados == total) {
clearInterval(hiloPrecarga);
play();
   }
}
stop();

Por mundis

5 de clabLevel



 

safari
Citar            
MensajeEscrito el 01 Oct 2010 07:08 pm
JOrge !

este codigo use para un swf que carga una canción !
intente se lo agregue al playlist d ahora y no funciona. es que ahora son 20 canciones.



stop();
function cargar_mp3(mp3) {
cancion = new Sound();
cancion.loadSound(mp3, true);
this.onEnterFrame = function() {
BytesLoaded = cancion.getBytesLoaded();
BytesTotal = cancion.getBytesTotal();
porcentaje = Math.floor(BytesLoaded/BytesTotal*100);
if (!isNaN(porcentaje)) {
estado.text = porcentaje+"%";
}
};
cancion.onLoad = function() {
delete onEnterFrame;
estado.text = " ";
};
}
cargar_mp3("http://www.lineazompa.com.ar/1_salvetti.mp3");
b_pause.onRelease = function() {
ultimaPosicion = Math.round(cancion.position/1000);
cancion.stop();
};
b_stop.onRelease = function() {
ultimaPosicion = 0;
cancion.stop();
};
b_play.onRelease = function() {
if (ultimaPosicion == 0) {
cancion.start();
} else {
cancion.start(ultimaPosicion);
}
};

















este código uso para cargar mis peliculas !
estuve viendo pero me cuesta entender , como agrgarle porcentaje para cada cancion





function cargando() {
var total, cargados, porcentaje;
total = _root.getBytesTotal();
cargados = _root.getBytesLoaded();
porcentaje = Math.floor((cargados*100)/total);
porcentaje_txt.text = porcentaje + " %";
barra_mc.gotoAndStop(porcentaje);
if (cargados == total) {
clearInterval(hiloPrecarga);
play();
}
}
stop();

Por mundis

5 de clabLevel



 

safari
Citar            
MensajeEscrito el 01 Oct 2010 07:09 pm

Por mundis

5 de clabLevel



 

safari
Citar            
MensajeEscrito el 04 Oct 2010 09:06 pm
hola jorge ! asi es como quedo el codifgo d playlist
pero no se ve el porcentaje. en un txt dinamico. con el nombre d estado.
pero no funciona, si me funciona sin la lista xml, y con una sola cancion
cómo podré adaptarlo a mi playlist, para que se vea porcentaje % ???
gracias



Código ActionScript :

var cancion_actual:Number=8
cancion=new Sound()
System.useCodepage=true
var canciones_xml:XML = new XML();
canciones_xml.ignoreWhite=true
canciones_xml.onLoad = function() {
   cargar_cancion(reproducir)
};
canciones_xml.load("canciones.xml");
cargar_cancion = function(reproducir) {
   nombre_cancion = canciones_xml.childNodes[0].childNodes[cancion_actual-1].childNodes[1]
   titulo_cancion.txt_titulo.anim_titulo.titulo_cancion.htmlText=nombre_cancion;
   cancion.loadSound(cancion_actual+".mp3",true)
}
this.onEnterFrame = function() {
   BytesLoaded = cancion.getBytesLoaded();
   BytesTotal = cancion.getBytesTotal();
   porcentaje = Math.floor(BytesLoaded/BytesTotal*100);
    if (!isNaN(porcentaje)) {
      estado.text = porcentaje+"%"; 
   }
};
cancion.onLoad = function() {
  delete onEnterFrame;
  estado.text = " ";
}
cancion.onSoundComplete = function (){
    boton_siguiente.onRelease();
}
boton_siguiente.onRelease=function() {
   cancion_actual++
   if(cancion_actual<=12) {
      cancion.stop()
      cancion.start()
      cargar_cancion(cancion_actual)
   } else {
      cancion_actual=8
      cargar_cancion(cancion_actual)
   }
};
boton_atras.onRelease=function() {
   cancion_actual--
   if(cancion_actual>=8) {
      cancion.stop()
      cancion.start()
      cargar_cancion(cancion_actual)
   } else {
      cancion_actual=12
      cargar_cancion(cancion_actual)
   }
};
boton_stop.onRelease=function(){
   boton_atras.enabled=false
   boton_siguiente.enabled=false
   titulo_cancion.txt_titulo.anim_titulo.titulo_cancion.htmlText="play para escuchar";
   cancion.stop()
}
boton_play.onRelease=function(){
   boton_atras.enabled=true
   boton_siguiente.enabled=true
   cancion_actual=8
   cargar_cancion(cancion_actual)
}

Por mundis

5 de clabLevel



 

safari
Citar            
MensajeEscrito el 04 Oct 2010 09:22 pm
El preload tiene que ir dentro del método cargar_canción, algo así:

Código ActionScript :

cargar_cancion = function(reproducir) { 
   nombre_cancion = canciones_xml.childNodes[0].childNodes[cancion_actual-1].childNodes[1] 
   titulo_cancion.txt_titulo.anim_titulo.titulo_cancion.htmlText=nombre_cancion; 
   cancion.loadSound(cancion_actual+".mp3",true) 
  this.onEnterFrame = function() { 
   BytesLoaded = cancion.getBytesLoaded(); 
   BytesTotal = cancion.getBytesTotal(); 
   porcentaje = Math.floor(BytesLoaded/BytesTotal*100); 
    if (!isNaN(porcentaje)) { 
      estado.text = porcentaje+"%";  
   }
    if(porcentaje>=100){
     delete onEnterFrame; 
     estado.text = " "; 
   } 
 }
} 


Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos



Ultima edición por solisarg el 05 Oct 2010 01:55 pm, editado 1 vez

Argentina

firefox
Citar            
MensajeEscrito el 04 Oct 2010 10:12 pm
jorge me aparece error d sintaxis!
no encontré nada








var cancion_actual:Number=8
cancion=new Sound()

System.useCodepage=true
var canciones_xml:XML = new XML();
canciones_xml.ignoreWhite=true
canciones_xml.onLoad = function() {


cargar_cancion(reproducir)



};
canciones_xml.load("canciones.xml");

cargar_cancion = function (reproducir) {  
   nombre_cancion = canciones_xml.childNodes[0].childNodes[cancion_actual-1].childNodes[1]  
   titulo_cancion.txt_titulo.anim_titulo.titulo_cancion.htmlText=nombre_cancion;  
   cancion.loadSound(cancion_actual+".mp3",true)  
  this.onEnterFrame = function() {  
   BytesLoaded = cancion.getBytesLoaded();  
   BytesTotal = cancion.getBytesTotal();  
   porcentaje = Math.floor(BytesLoaded/BytesTotal*100);  
    if (!isNaN(porcentaje)) {  
      estado.text = porcentaje+"%";   
   } 
   if(porcentaje>=100){ 
     delete onEnterFrame;  
     estado.text = " ";  
  }  
}










cancion.onSoundComplete = function (){

boton_siguiente.onRelease();

}

boton_siguiente.onRelease=function() {
cancion_actual++
if(cancion_actual<=12) {
cancion.stop()
cancion.start()
cargar_cancion(cancion_actual)
} else {
cancion_actual=8
cargar_cancion(cancion_actual)
}

};

boton_atras.onRelease=function() {
cancion_actual--
if(cancion_actual>=8) {
cancion.stop()
cancion.start()
cargar_cancion(cancion_actual)
} else {
cancion_actual=12
cargar_cancion(cancion_actual)
}

};

boton_stop.onRelease=function(){
boton_atras.enabled=false
boton_siguiente.enabled=false
titulo_cancion.txt_titulo.anim_titulo.titulo_cancion.htmlText="play para escuchar";
cancion.stop()
}

boton_play.onRelease=function(){
boton_atras.enabled=true
boton_siguiente.enabled=true
cancion_actual=8
cargar_cancion(cancion_actual)
}

Por mundis

5 de clabLevel



 

safari
Citar            
MensajeEscrito el 05 Oct 2010 01:56 pm
Edité mi anterior código, faltaba una llave de cierre

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.