Enhanced XSPF Player With Autoresume Support

The Problem

You have a music player on your site. When users move from page to page, the music restarts at the beginning. You can solve this problem with a separate player window, but it doesn't work well with your site design. You can solve it with frames, but that creates even bigger problems.

The Solution

A Flash-based MP3 music player with an autoresume feature! I've added this feature to the popular, free XSPF Music Player software.

Read This First!

This player stores the player's current track and playback position in a Flash cookie. When the user moves between pages, the player goes away, of course. But the player on the new page will see the cookie and pick up where the first player left off. It's not perfect, there is a short gap while the new player starts up. If the whole song has been downloaded the gap is very short. Nothing can be done about this - the browser unloads the first page before it loads the new one, plain and simple. If the song is not completely loaded the gap may be somewhat longer.
Do you you want to embed more than one player on the same page? Don't use the autoresume option for more than one of the players. Currently my player assumes it is the only one on the page, so multiple copies will all attempt to resume from the same point. In the future I may add a "playerid" parameter to work around this, but usually it's not appropriate to use autoresume and have multiple players at the same time. Think about using a playlist without autoplay, instead of multiple players.

Fringe Benefits

When users click the "stop" button, you want to respect that. My autoresume code respects the stop button. If you click the player's "stop" button on page one, then go to page two, the music does not start up again. Which means that your users don't hate you! Hooray!

Important Requirements

All of the pages must embed the player, all of the pages must load the same playlist, and all of the pages must specify the autoresume option.

Changes

2006-12-29: shuffle and autoplay are fully compatible with autoresume. Volume control settings are remembered by autoresume. General bug fixes.

How To Download The Player

Click here to download the player software.

How To Set Up The Player

See my WWW FAQ article how do I embed sound and music in a page?

How To Turn On The Autoresume Feature

By default, autoresume is off. To turn it on, you need to add &autoresume=1 to the end of the player URL, as shown here:
<object 
  type="application/x-shockwave-flash" 
  width="400" height="170"
  data="xspf_player.swf?playlist_url=test.xspf&autoresume=1&autoplay=1">
<param 
  name="movie" 
  value="xspf_player.swf?playlist_url=test.xspf&autoresume=1&autoplay=1" />
</object>
If you don't understand the above, read this thoroughly first.

Credits

Fabricio Zuardi created the original XSPF Music Player. Lacy Morrow created an enhanced version with shuffle capabilities. My own version is based on Lacy Morrow's and adds the autoresume option.

Follow us on Twitter | Contact Us

Copyright 1994-2014 Boutell.Com, Inc. All Rights Reserved.