Situación: Tengo una página web con un reproductor de audio con un tema que se reproduce al cargar (exigencias del cliente...).
En la misma página hay otro reproductor que reproduce el mismo audio pero que al cargar no se reproduce. (¿?¿?¿? también exigencias del cliente...)
El problema: Localmente funciona, pero al publicarlo en la web los dos reproductores reproducen el audio al entrar en la web. Pero... solo en SAFARI!!
Podría ser un problema con onLoad ??
He útilizado el objeto sound, adjunto código de los dos archivos.
Si ven cualquier otro error o comentario sobre el código, me encantará oir su opinión.
Muchas gracias a todos!
Primer swf (se reproduce al inicio):
Código :
var pausa:Number = 0; var estado:Number = 1; btn.gotoAndStop(2); var my_interval:Number; var my_sound:Sound = new Sound(); my_sound.onLoad = function(success:Boolean) { if (success) { my_interval = setInterval(updateProgressBar, 100, my_sound); } }; my_sound.onSoundComplete = function() { clearInterval(my_interval); } my_sound.loadSound("http://www.miweb.com/media/audio.mp3", true); function updateProgressBar(the_sound:Sound):Void { var pos:Number = Math.round(the_sound.position/the_sound.duration*116); progressBar_mc.barra._x = pos; } btn.onRelease = function (){ if(estado == 0){ my_sound.start(pausa/1000); estado = 1; this.gotoAndStop(2); mut_mc.gotoAndStop(1); mut_mc.enabled = true; if(pausa == 0){ my_interval = setInterval(updateProgressBar, 1000, my_sound); } } else { my_sound.stop(); estado = 0; this.gotoAndStop(1); pausa = my_sound.position; mut_mc.enabled = false; } } mut_mc.onRelease = function(){ if( estado == 1){ my_sound.stop(); pos = 0; pausa = 0; estado = 0; clearInterval(my_interval); btn.gotoAndStop(1); this.gotoAndStop(2); }else{ this.gotoAndStop(1); } }
Segundo swf (stop):
Código :
var pausa:Number = 0; var estado2:Number = 0; mut_mc.enabled = false; var my_interval:Number; var my_sound:Sound = new Sound(); my_sound.onLoad = function(success:Boolean) { if (success) { my_sound.stop(); } }; my_sound.onSoundComplete = function() { clearInterval(my_interval); } my_sound.loadSound("http://www.miweb.com/media/audio.mp3", true); function updateProgressBar(the_sound:Sound):Void { var pos:Number = Math.round(the_sound.position/the_sound.duration*116); progressBar_mc.barra._x = pos; } btn.onRelease = function (){ if(estado2 == 0){ my_sound.start(pausa/1000); estado2 = 1; this.gotoAndStop(2); mut_mc.gotoAndStop(1); mut_mc.enabled = true; if(pausa == 0){ my_interval = setInterval(updateProgressBar, 100, my_sound); } } else { my_sound.stop(); estado2 = 0; this.gotoAndStop(1); pausa = my_sound.position; mut_mc.enabled = false; } } mut_mc.onRelease = function(){ if( estado2 == 1){ my_sound.stop(); pos = 0; pausa = 0; estado2 = 0; clearInterval(my_interval); btn.gotoAndStop(1); this.gotoAndStop(2); }else{ this.gotoAndStop(1); } }