OK, now that you've added the Yahoo! WebPlayer code to your site, you're ready to make your pages "playable". There are a few different ways to do this, as well as some tricks to customize the experience, which we'll cover below.
The Yahoo! WebPlayer looks for links to audio files on your site and add play buttons when it finds them. If your links have a file extension for a supported format (e.g. .mp3, .wma, etc...), the Yahoo! WebPlayer will pick it up. The simplest way to get an audio play button is to link to an mp3 file.
The Yahoo! WebPlayer detects and plays links to YouTube video pages. Go to youtube.com and search for a video, then copy and paste the video page URL into your page. YouTube video page URLs look like this: http://www.youtube.com/watch?v=spgEJhvygZg.
The Yahoo! WebPlayer will detect links to movie pages on Yahoo! Movies and add play buttons. Just go to Yahoo! Movies at http://movies.yahoo.com and search for a movie, then copy and paste the movie page URL into your page. Movie page URLs look like this: http://movies.yahoo.com/movie/1810190842/info.
If you enabled our term recognition feature, then it couldn't be easier to add video to your site. Simply mention a movie title in quotes and if the Yahoo! WebPlayer recognizes the title, it'll get a play button and your visitors will be able to play the movie trailer. We are continually refining and improving our term recognition technology, but some terms may get missed. If that happens, use one of the other methods mentioned here to add video or audio for a given term.
The "type" attribute indicates the MIME type of the file. If this is a supported audio file type, the Yahoo! WebPlayer will know that the link is playable. If the type attribute is set, the Yahoo! WebPlayer ignores the file extension. In this example, the link would be considered playable:
By default, items are loaded into the player in the order they appear on a page, meaning the order in which they appear to the HTML parser. To override this default order you can use the "tabindex" attribute. For example:
The "title" attribute can be used to specify the name of the item. The Yahoo! WebPlayer will use whatever is in the title attribute as the title it displays in the player while playing. If the title attribute is not used, the Yahoo! WebPlayer will use the anchor text as the display name for that item. In this example, the link on the page will show "a song", while the song title in the Yahoo! WebPlayer will appear as "Movin' Right Along".
Setting the class of an item to htrack explicitly marks that item to be added to the playlist. When the Yahoo! WebPlayer detects at least one link with the htrack classs, it will include all links with the htrack class in the playlist, and it will ignore any links that do not have the htrack class. This is helpful if you want the player to detect specific items and ignore others.
<a href="mysong.mp3" class="htrack">a song</a> <a href="song-to-exclude-from-playlist.mp3">Ignored song</a>
The "noplay" class lets you explicitly mark an item to be ignored by the player. Setting class="noplay" will prevent the item from appearing in the Yahoo! WebPlayer's playlist. For example:
You can set the image which is displayed in the player during a song. To do this, put a hidden img element within the playable link. For example:
The dimensions of the image should be square, not rectangular
Make sure you add style="display:none" to your image tag so it does not show up directly in the main web page.
Save your xspf as a separate file (e.g. example.xspf) on your server and include a link to that file on the page where you want the play button to appear. Here is an example of how to format an xspf file:
<?xml version="1.0" encoding="UTF-8" ?>
<playlist version="1" xmlns="http://xspf.org/ns/0/">
<trackList>
<track>
<location>http://example.com/song.mp3</location>
<title>Song Title</title>
<creator>Artist</creator>
<album>Album</album>
<image>http://example.com/art.jpg</image>
</track>
</trackList>
</playlist>