Comunidad de diseño web y desarrollo en internet online

Streaming

Citar            
MensajeEscrito el 01 Nov 2010 08:34 pm
Hola!!!

Me gustaria crear un reproductor mp3 que cargue camciones dinamicamente desde un xml, pero estas deben reproducirse en streming, no tengo ni idea por donde empezar, tal vez si me pasaran un link de un tutorial o algo

Gracias!!!

Por dianita666

Claber

185 de clabLevel



 

firefox
Citar            
MensajeEscrito el 01 Nov 2010 09:02 pm
¿Te refieres a streaming real o a progressive download?
Si quieres simular streaming mientras se descarga, en Sound.load, pasa un segundo parámetro de un SoundLoaderContext con bufferTime de 0 (intenta reproducirlo mientras se carga)

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 08 Nov 2010 03:03 pm
Hola Jorge!!!!!

Entonces crees que pueda hacer mi reproductor con uno de los tuto que hay por ahi y luego le agrego el SoundLoaderContext
para agregarle el streaming, o antes debo tener algo mas en cuenta?


Gracias por tu respuesta Jorge!!!

Por dianita666

Claber

185 de clabLevel



 

firefox
Citar            
MensajeEscrito el 08 Nov 2010 03:05 pm
Solo eso, en AS2 simplemente le pasabas un segundo parámetro a true en Sound.loadSound, ahora cambia el método, pero intenta lo mismo: reproducirlo mientras se va bajando

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 08 Nov 2010 07:00 pm
Hola Jorge!!
Este es el code de mi mp3player,
me indicarias porfa como agregarle el SoundLoaderContext.

Entiendo que seria en la funcion Loaded pero no estoy segura de como vincularlo al URLRequest

Gracias!!!

Código ActionScript :

//mp3 player
        private function Loaded(e:Event):void{  
          xml = new XML(e.target.data);  
          songList = xml.song;  
          musicReq = new URLRequest(songList[0].url);   
          music.load(musicReq);  
          sndC = music.play();  
        mp3player_mc.title_txt.text = songList[0].title;
           sndC.addEventListener(Event.SOUND_COMPLETE, nextSong);
      } 
      
        private function prevSong(e:Event):void{  
            if(currentIndex > 0){  
               currentIndex--;
            }
            else{  
              currentIndex = songList.length() - 1;  
             }  
         var prevReq:URLRequest = new URLRequest(songList[currentIndex].url);  
           var prevPlay:Sound = new Sound(prevReq);  
            sndC.stop();  
            mp3player_mc.title_txt.text = songList[currentIndex].title;    
            sndC = prevPlay.play();  
            currentSnd = prevPlay;  
           // songPaused = false;   
          sndC.addEventListener(Event.SOUND_COMPLETE, nextSong);  
       } 
       
        private  function nextSong(e:Event):void {  
            if(currentIndex < (songList.length() - 1)){  
                 currentIndex++;  
            }  
                else {  
               currentIndex = 0;
             }  
         var nextReq:URLRequest = new URLRequest(songList[currentIndex].url);  
          var nextPlay:Sound = new Sound(nextReq);  
         sndC.stop();  
         mp3player_mc.title_txt.text = songList[currentIndex].title;   
         sndC = nextPlay.play();  
          currentSnd = nextPlay;  
        // songPaused = false;  
         sndC.addEventListener(Event.SOUND_COMPLETE, nextSong);
       }
       
        private function playSong(e:Event):void{
          if(songPaused){
             sndC = currentSnd.play(position);
             //songPaused = false;
             }  
              else if(songStopped){  
                  sndC = currentSnd.play(position);  
                  songStopped = false;  
             }  
            else if(!sndC){  
           sndC = currentSnd.play(position);
         }
         }
         
        private function stopSong(e:Event):void{
           sndC.stop();  
             position = 0;  
              songStopped = true;
           }   

Por dianita666

Claber

185 de clabLevel



 

firefox
Citar            
MensajeEscrito el 08 Nov 2010 07:11 pm
Algo así:

Código ActionScript :

//Esto lo creas fuera de cualquier función, porque lo tienes que volver a usar
var sndContext:SoundContext = new SoundLoaderContext(0, false)

//lo pasas en Loaded
music.load(musicReq, sndContext);   

Luego en los dos constructores de next y prev lo mismo

//function prevSong
var prevPlay:Sound = new Sound(prevReq, sndContext);   

//función nextSong
var nextPlay:Sound = new Sound(nextReq, sndContext);   


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 08 Nov 2010 07:14 pm, editado 1 vez

Argentina

firefox
Citar            
MensajeEscrito el 08 Nov 2010 07:12 pm
Bien
agregue esto a la funcion loaded:

Código ActionScript :

var context:SoundLoaderContext = new SoundLoaderContext(30000, false);

          music.load(musicReq, context);  
          sndC = music.play();  


supongo que asi deberia funcionar cuando lo suba

Gracias Jorge!!!

Por dianita666

Claber

185 de clabLevel



 

firefox
Citar            
MensajeEscrito el 08 Nov 2010 07:14 pm
se me olvidaba:

En que casos es false y en cuales true?

seria necesario agregarle una funcion de error?

Gracias Jorge!!!

Por dianita666

Claber

185 de clabLevel



 

firefox
Citar            
MensajeEscrito el 08 Nov 2010 07:16 pm
Mira la clase SoundLoaderContext en la ayuda, explica los parámetros del constructor, el segundo es por si quieres chequear o no el crossdomain

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.