Jump to content

online mp3 player in javascript


mazazino

Recommended Posts

I have this code that plays songs online (streaming)..but it doesn't play .mp3 files..so can anyone help me get a music player for streaming mp3 files?

 

 

<script type="text/javascript">

function PlayerOpen(soundfiledesc,soundfilepath) {

    PlayWin = window.open('','','width=550,height=150,top=25,left=250,resizable=0,scrollbars=0,titlebar=0,toolbar=0,menubar=0,status=0,directories=0,personalbar=0');

    PlayWin.focus();

 

    var winContent = "<HTML><HEAD><TITLE>" + soundfiledesc + "</TITLE><LINK rel='stylesheet' type='text/css' name='style1' href='/styles/media_player.css'></HEAD><BODY bgcolor='#ffffff'><center>";

    winContent += "<div style='font-size:11px; font-weight:bold; font-family:Verdana,sans-serif;line-height:1.5'>" + soundfiledesc + "</div>";

 

    winContent += "<OBJECT width='300' height='42'>";

    winContent += "<param name='SRC' value='" + soundfilepath + "'>";

    winContent += "<param name='AUTOPLAY' VALUE='true'>";

    winContent += "<param name='CONTROLLER' VALUE='true'>";

    winContent += "<param name='BGCOLOR' VALUE='#FF9900'>";

    winContent += "<EMBED TYPE='application/x-mplayer2' pluginspage='http://www.microsoft.com/isapi/redir.dll?prd=windows&sbp=mediaplayer&ar=Media&sba=Plugin&' SRC='" + soundfilepath + "' AUTOSTART='TRUE' LOOP='FALSE' WIDTH='375' HEIGHT='42' CONTROLLER='TRUE' BGCOLOR='#e0e0e0'></EMBED>";

    winContent += "</OBJECT>";

 

    winContent += "<p style='font-size:12px;font-family:Verdana,sans-serif;text-align:center'><a href='" + soundfilepath +"'>Right-Click to Download</a></p>";

    winContent += "<FORM><DIV align='center'><INPUT type='button' value='Close this window' onclick='javascript:window.close();'></DIV></FORM>";

    winContent += "</center></BODY></HTML>";

 

    PlayWin.document.write(winContent);

 

    }

</script>

 

Link to comment
Share on other sites

Hey have you tried XSPF player http://musicplayer.sourceforge.net/? It's done in flash, but you can make your own playlists (using the XSPF paylist format http://www.xspf.org/) and embed it in a webpage.

 

Maybe this will help you. I thought about using it for my band's website but it only deals with mp3s which is fine for you but we had some legal reasons for not wanting that...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.