tags:

views:

80

answers:

4

my music is keept on desktop with this name

doli mix - arcax(Mus.Ge).mp3 

how to write code to play this music in html?

+1  A: 

You can use the HTML 5 audio tag (reference here):

<audio src="yourfile.ogg" controls="controls">

Of course this won't work on older browsers.

marcgg
-1 cause it won't work anywhere
Jan Jongboom
@jan jongboom: Except in recent browsers like firefox, safari... and generally speaking recent layout engines like gecko, webkit and presto. but aside from that, it won't work _anywhere_ :\
marcgg
+2  A: 

Here is a short guide.

klausbyskov
+4  A: 

HTML is just a markup language. As such, it can't play music. In fact, it can't even display anything. All the rendering is done by the browser.

So what you want is to make the browser play music, and that can be done using the <embed> tag:

<embed src="yourfile.mp3" autostart=true loop=false volume=100 
hidden=true><noembed><bgsound src="yourfile.mp3"></noembed>

I strongly recommend not doing this though, since it's extremely annoying.

NullUserException
A: 

Even a simple anchor tag <a href="file://yourfile">mp3</a> will play this music if you have your browser set up with a plugin like VLC, QuickTime, Windows Media Player, etc. Click the link and it will take you to a new page with the media renderer.

selfsimilar