Yahoo! Media Player
Line 9: Line 9:
   
 
== Anchor Element Attributes ==
 
== Anchor Element Attributes ==
  +
allen music
 
 
''href'':
 
''href'':
 
: A URL for an audio file. For example: <code><pre><a href="example.mp3">a song</a></pre></code>
 
: A URL for an audio file. For example: <code><pre><a href="example.mp3">a song</a></pre></code>

Revision as of 01:57, 30 December 2008

You add audio to your web page by linking to it:

<a href="http://example.com/song.mp3">My Favorite Tune</a>

This page explains how you can have more fine-grained control over the player by using standard attributes of the <a> (anchor) element, like this:

<a href="http://example.com/mp3/song" class="htrack" tabindex="1" 
   title="Movin' Right Along" type="audio/mpeg">my favorite song</a>

Anchor Element Attributes

allen music href:

A URL for an audio file. For example:
<a href="example.mp3">a song</a>

type:

The MIME type of the file. If this is an audio file type, Yahoo! Media Player will know that the link is playable. For example:
<a href="http://example.com/mysong" type="audio/mpeg">a song</a>

tabindex:

By default, tracks are loaded into the player in document order, meaning the order in which they appear to the HTML parser. To override this default order you can use the tabindex attribute. See the HTML specification for details. For example:
<a href="example1.mp3" tabindex="2">second song</a><a href="example2.mp3" tabindex="1">first song</a>

title:

The "title" attribute can be used to specify the audio file's name. For example:
<a href="example.mp3" title="Movin' Right Along">a song</a>

class="htrack":

Explicitly marks audio that should be added to the play queue. For example:
<a href="example" class="htrack">a song</a>

Album Art

You can set the image which is displayed in the player during a song. To do this, put an img element within the playable link.

For example:

<a href="example.mp3"><img src="example.png" alt="" />my song</a>

The dimensions of the image should be square, not rectangular.

If you don't want the image to show up directly in the main web page, add style="display:none" to your img tag:

<a href="example.mp3"><img src="example.png" alt="" style="display:none" />my song</a>


Link hiding

To conceal links from the user, see Link hiding