JavaScript Web based JavaScript Media Player

Discussion in 'Web Development' started by JavaScriptBank, Jul 21, 2010.

  1. Bring the sound of life - music to your visitors by this JavaScript. It is an advanced web based midi player that actually enables you to jump, pause, and manipulate the play list like never before.... detail at JavaScriptBank.com - 2.000+ free JavaScript codes

    [​IMG]
    Demo:
    javascriptbank.com/web-based-javascript-media-player.html/en/

    How to setup

    Step 1: Use JavaScript code below to setup the script
    JavaScript
    Code:
    <SCRIPT language=JavaScript>
    <!-- Begin
    counter = 0;
    html = true;
    songs = new Array();
    function addsong() {
    file = document.forms[0].file.value;
    if(file == "") {
    alert("Entra un nombre de archivo o da click en Examinar..");
    }
    else {
    fn = file;
    while(fn.indexOf() != -1) {
    pos = fn.indexOf();
    fn = fn.substring(fn.lenght);
    }
    if(fn.indexOf(".gif") == 1) {
    alert("Sólo sonidos o música");
    }
    else {
    songs[counter] = file;
    document.forms[0].selMusica[counter] = new Option(fn, file, false, true);
    counter++;
    }
    document.forms[0].file.value = "";
    }
    }
    function musica() {
    document.all.sound.src=document.clock.selMusica.options[document.clock.selMusica.selectedIndex].text;
    }
    function stop() {
    document.all.sound.src="";
    }
    function count() {
    document.clock.songs.value=document.clock.selMusica.options.length;
    }
    function deletethis() {
    if(counter > 0) {
    counter--;
    document.forms[0].selMusica[counter] = null;
    songs[counter] = "";
    }
    else {
    alert("No hay nada en la lista!");
       }
    }
    function bajar() {
    document.clock.selMusica.options[document.clock.selMusica.selectedIndex++];
    saber2();
    saber();
    }
    function subir() {
    document.clock.selMusica.options[document.clock.selMusica.selectedIndex--];
    saber2();
    saber();
    }
    function saber() {
    document.clock.url.value=document.clock.selMusica.options[document.clock.selMusica.selectedIndex].text;
    }
    function saber2() {
    fn = document.clock.selMusica.options[document.clock.selMusica.selectedIndex].text;
    char = unescape("%5C");
    while(fn.indexOf(char) != -1) {
    pos = fn.indexOf(char);
    fn = fn.substring(pos + 1, fn.length);
    document.clock.nombre.value=fn;
    }
    }
    // End-->
    </SCRIPT>
    Step 2: Copy & Paste HTML code below in your BODY section
    HTML
    Code:
    <BODY onclick=count() onload=count()>
    <BGSOUND id=sound src="">
    <FORM name=clock><INPUT type=file name=file size="20"> <INPUT onclick=addsong() type=button value=Add><INPUT onclick=deletethis() type=button value=Delete><BR><INPUT onclick=musica() type=button value=Listen name=empezar> 
    <INPUT onclick=stop() type=button value=Stop name=detener> You have:<INPUT 
    readOnly size=2 name=songs>song(s) in the list.<BR>Name of the song:<INPUT 
    size=25 name=nombre><INPUT onclick="saber2(); saber()" type=button value="Know Name & Url">Url 
        of the song:<INPUT size=19 name=url> <BR><INPUT onclick=bajar() type=button value=MoveDown><INPUT onclick=subir() type=button value=MoveUp><BR><BR><SELECT 
    multiple size=20 name=selMusica></SELECT> </FORM>
    </BODY>

    AJAX news ticker - JavaScript Refresh Page - JavaScript Unclosable Window​