faded
faded

Reputation: 47

playing music through links

everyone, i have some question, is there a way that a link of music can be played on a particular player on a webpage?

Upvotes: 0

Views: 167

Answers (3)

Damian Silva
Damian Silva

Reputation: 336

Use the HTML5 audio tag to embed links to audio sources. It will be played with the browser's default controls. Alternatively, you could create a custom audio player using JavaScript, and still use the audio tag.

<audio src="http://fidelak.free.fr/reprises/The%20Doors%20-%20People%20are%20Strange.mp3" controls>
</audio>

Upvotes: 0

mylesagray
mylesagray

Reputation: 8869

You could do something like this to force playing through QuickTime player:

<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" WIDTH="64" HEIGHT="16">
        <PARAM NAME="src" VALUE="FILE PATH HERE" >
        <PARAM NAME="autoplay" VALUE="true" >
        <EMBED PLUGINSPAGE="http://www.apple.com/quicktime/download/"
        SRC="FILE PATH HERE" TYPE="image/x-quicktime"
        WIDTH="64" HEIGHT="16" QTSRC="FILE PATH HERE"
        AUTOPLAY="true" > 
        </EMBED>
    </OBJECT>

Upvotes: 0

Marc B
Marc B

Reputation: 360732

You can't control how the browser plays any kind of media - that's under the control of the user and the browser - and you have no idea if any particular software's installed. At best you can do is embed the media file and hope that the client's got a player that can handle the file and/or mime-type.

For instance, you couldn't do (making up a horribly ugly tag):

<embed media="mytune.mp3" playwith="winamp" />

You can't tell if the user's got winamp installed. At most you could do something like

<embed media="mytune.mp3" mimetype="audio/mpeg" />

and hope they've got something which can play that.

Upvotes: 1

Related Questions