Comunidad de diseño web y desarrollo en internet online

Soy nuevo en esto, pero me vendría bien un poco de ayuda ..

Citar            
MensajeEscrito el 20 Feb 2009 04:48 am
Sepan entender soy nuevo en esto. Tengo un reproductor de mp3 en mi Web el cual funciona perfectamente con su respectiva playlist en xml. El tema en cuestión es que estoy queriendo desarrollar este mismo reproductor pero incluirle 3 botones que direccionen a 3 playlist distintas y que el usuario pueda optar entre estas opciones sin la necesidad de cambiar de reproductor o redireccionar la pagina. Si me pueden ayudar estaré eternamente agradecido.
Saludos.

Mi web es : www.alternativoquimera.com
Y el cidigo script del reproductor es el siguiente

Código :

function initSound()
{
    song = new Sound();
    song.onID3 = function ()
    {
        display.updateID3(this.id3);
    }
    ;
}

function updateStatus()
{
    updateButtons();
    if (isplaying && !ispaused) 
    {
        display.updateStatus("SONANDO", true);
        var noduration = true;
        this.onEnterFrame = function ()
        {
            if (song.duration > 0 && noduration) 
            {
                display.updateDuration(song.duration);
            }

            slide_position.setPerc(song.position * 100 / song.duration, false);
            display.updatePosition(song.position, true);
        }
        ;
        return;
    }

    delete this.onEnterFrame;
    if (ispaused) 
    {
        display.updateStatus("PAUSADO", true);
    }
    else 
    {
        display.updateStatus("<font color=\"#EE3300\">DETENIDO</font>", false);
    }


    display.updatePosition(song.position, true);
}

function holdStatus()
{
    delete this.onEnterFrame;
}

function updateButtons()
{
    if (isplaying && !ispaused) 
    {
        but_play.symbol = "pause";
        but_stop.deActivate();
        return;
    }

    but_play.symbol = "play";
    if (!isplaying) 
    {
        but_stop.activate();
        return;
    }

    but_stop.deActivate();
}

function pressed(obj)
{
    if ((__reg0 = obj) === but_stop) 
    {
        stopSong();
        updateButtons();
        return;
    }
    else 
    {
        if (__reg0 === but_play) 
        {
            if (isplaying) 
            {
                if (ispaused) 
                {
                    playSong(false);
                }
                else 
                {
                    pauseSong();
                }


            }
            else 
            {
                playSong(true);
            }


            updateButtons();
            return;
        }
        else 
        {
            if (__reg0 === but_back) 
            {
                doStep(-1);
                return;
            }
            else 
            {
                if (__reg0 !== but_fore) 
                {
                    return;
                }

            }


        }


    }


    doStep(1);
    return;
}

function setSong(n, willplay)
{
    stopSong();
    current_song = n;
    initSound();
    if (willplay) 
    {
        playSong(true);
    }

}

function playSong(newsong)
{
    if (current_song > -1) 
    {
        isplaying = true;
        ispaused = false;
        if (newsong) 
        {
            song.loadSound(list[current_song], true);
            song.setVolume(slide_volume._value);
            song.setPan(Math.round(slide_pan._value * 2) - 100);
        }
        else 
        {
            song.start(last_position, 0);
        }


        updateStatus();
    }

}

function stopSong()
{
    isplaying = false;
    ispaused = false;
    last_position = 0;
    song.stop();
    updateStatus();
}

function pauseSong()
{
    if (!ispaused && isplaying) 
    {
        ispaused = true;
        last_position = song.position / 1000;
        song.stop();
        updateStatus();
        return;
    }

    if (isplaying) 
    {
        playSong();
    }

}

function doStep(offset)
{
    current_song = current_song + offset;
    if (current_song < 0) 
    {
        current_song = list.length - 1;
    }

    if (current_song > list.length - 1) 
    {
        current_song = 0;
    }

    playlist.select(current_song);
    setSong(current_song, isplaying);
}

function parse(obj)
{
    var __reg1 = 0;
    while (__reg1 < obj.childNodes.length) 
    {
        list[__reg1] = obj.childNodes[__reg1].firstChild.toString();
        ++__reg1;
    }

    playlist.initList(list);
}

slide_volume._label = "Volumen";
slide_pan._label = "Balance";
slide_position._label = "POCICIÓN";
_global.player_root = this;
var song = new Sound(this);
var list = new Array();
var isplaying = false;
var ispaused = false;
var last_position = 0;
var current_song = -1;
this.onEnterFrame = function ()
{
    slide_volume.setPerc(50);
    slide_pan.setPerc(50);
    slide_position.setPerc(0);
    but_stop.activate();
    delete this.onEnterFrame;
}
;
but_stop.symbol = "stop";
but_stop.cantoggle = false;
but_play.symbol = "play";
but_play.cantoggle = true;
but_back.symbol = "back";
but_back.cantoggle = false;
but_fore.symbol = "fore";
but_fore.cantoggle = false;
slide_volume.onMove = function (p)
{
    song.setVolume(Math.round(p));
    holdStatus();
    display.updatePosition(Math.round(p), false);
}
;
slide_volume.onTouch = function ()
{
    display.updateStatus("<font color=\"#FFCC00\">VOLUME</font>", false);
}
;
slide_volume.onChange = function ()
{
    updateStatus();
}
;
slide_pan.onMove = function (p)
{
    var __reg1 = Math.round(p * 2) - 100;
    if (Math.abs(__reg1) < 2) 
    {
        __reg1 = 0;
    }

    song.setPan(__reg1);
    holdStatus();
    var __reg2 = __reg1 >= 0 ? "R" : "L";
    if (__reg1 == 0) 
    {
        __reg2 = " ";
    }

    display.updatePosition(Math.abs(__reg1) + __reg2, false);
}
;
slide_pan.onTouch = function ()
{
    display.updateStatus("<font color=\"#FFCC00\">BALANCE</font>", false);
}
;
slide_pan.onChange = function ()
{
    updateStatus();
}
;
slide_position.onMove = function (p)
{
    holdStatus();
    var __reg1 = p * song.duration / 100;
    display.updatePosition(__reg1, true);
}
;
slide_position.onTouch = function ()
{
    if (isplaying) 
    {
        display.updateStatus("<font color=\"#FFCC00\">POSITION</font>", false);
    }

}
;
slide_position.onChange = function (p)
{
    var __reg1 = p * song.duration / 100;
    if (isplaying && !ispaused) 
    {
        song.start(__reg1 / 1000, 0);
    }
    else 
    {
        if (isplaying) 
        {
            last_position = __reg1 / 1000;
        }

    }


    updateStatus();
}
;
var xm = new XML();
xm.ignoreWhite = true;
xm.onLoad = function ()
{
    parse(this);
}
;
xm.load("playlist.xml");

Por Gringuex

3 de clabLevel



Genero:Masculino  

Musico Baterista

msie7
Citar            
MensajeEscrito el 20 Feb 2009 07:05 pm
¡300 líneas de código! Tu si que eres nuevo ;)

Hay una forma muy simple: carga distintos playlist con distintos botones. Ahora carga por defecto este:

xm.load("playlist.xml");

Haz que otros botones carguen otros XML, aunque no se si este player está preparado para recargar playlists

Jorge

Por solisarg

BOFH

13669 de clabLevel

4 tutoriales
5 articulos

Genero:Masculino   Bastard Operators From Hell Premio_Secretos

Argentina

firefox
Citar            
MensajeEscrito el 24 Feb 2009 02:39 pm
jajajajajaja 300 lineas para un reproductor jajajajajajajajaja de donde sacaste ese codigo XD, pero que es mejor que el window media :P

Byee Saludos!

Por wawi

325 de clabLevel

2 tutoriales

 

Argentina

firefox

 

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