Example 5
This example shows how you can load items into Wimpy and control the player through standard HTML
- Load and Play: track 1
- Load and Play: track 2
- Load and Play: track 3
- Add Track, but don't play
- Add Playlist
- Clear Playlist
- Load and open and external XML playlist
- Play
- Stop
- Pause
- Go to and play the second track in the playlist
- Next
- Previous
- Change Cover Art
- Update the scrolling text to say "Hello Mom"
<script language='javascript' src='wimpy.js'></script>
<div id="wimpyTarget">This DIV content will be replaced by Wimpy.</div>
<script language="JavaScript" >
// Render the player on the page:
makeWimpyPlayer("blank.xml");
// NOTE: If you just want to load the player without a start up track or playlist, you'll have to "trick" wimpy by referencing an XML file that doesn't exist, or references a playlist that doesn't have any <item>'s in it. If you reference an XML file that doesn't exist (as in this example) you may recieve 404 errors in your server logs, so referencing "real" file that doesn't have any <items> will eliminate server log entries.
</script>
The following HTML links are used to trigger actions in the player:
<a href="javascript:;" onClick="wimpy_addTrack(true, 'example1.mp3', '', 'Track 1', '', 'example1.jpg');">
- Load and Play: track 1
</a>
<a href="javascript:;" onClick="wimpy_addTrack(true, 'example2.mp3', '', 'Track 2', '', 'example2.jpg');">
- Load and Play: track 2
</a>
<a href="javascript:;" onClick="wimpy_addTrack(true, 'example3.mp3', '', 'Track 3', '', 'example3.jpg');">
- Load and Play: track 3
</a>
<a href="javascript:;" onClick="wimpy_addTrack(false, 'example4.mp3', 'My Artist', 'My Title', 'http://www.wimpyplayer.com', exampleCA.jpg');">
- Add Track, but don't play
</a>
<a href="javascript:;" onClick="wimpy_addTrack(false, 'playlist1.xml', '', 'Band\'s Title', 'http://www.wimpyplayer.com', exampleCA.jpg');">
- Add Playlist
</a>
<a href="javascript:;" onClick="wimpy_clearPlaylist();">
- Clear Playlist
</a>
<a href="javascript:;" onClick="wimpy_loadExternalPlaylist('playlist1.xml');">
- Load and open and external XML playlist
</a>
<a href="javascript:;" onClick="wimpy_play();">
- Play
</a>
<a href="javascript:;" onClick="wimpy_stop();">
- Stop
</a>
<a href="javascript:;" onClick="wimpy_pause();">
- Pause
</a>
<a href="javascript:;" onClick="wimpy_gotoTrack(2);">
- Go to and play the second track in the playlist
</a>
<a href="javascript:;" onClick="wimpy_next();">
- Next
</a>
<a href="javascript:;" onClick="wimpy_prev();">
- Previous
</a>
<a href="javascript:;" onClick="wimpy_changeVisual('exampleCA.jpg', 'http://www.gieson.com');">
- Change Cover Art
</a>
<a href="javascript:;" onClick="wimpy_updateInfoDisplay('Hello', 'Mom');">
- Update the scrolling text to say "Hello Mom"
</a>