Preventing caching of audio, or forcing reload

613 views
Skip to first unread message

Mike Hogan

unread,
May 2, 2011, 2:16:41 PM5/2/11
to jPlayer: HTML5 Audio & Video for jQuery
Hi there,

I want to configure jPlayer in a way that it plays a different song
each time the play button is pressed. So I want it to _always_ go to
my server to fetch a new mp3.

Currently I am using the same URL each time, and I guess the browser
is caching the MP3. Is there any way I can prevent that?
Alternatively, is there a way i can force jPlayer to reload?

Thanks for your help,
Mike

Mark Panaghiston

unread,
May 2, 2011, 2:41:50 PM5/2/11
to jpl...@googlegroups.com
Hello Mike,

Are you serving a different actual MP3 file from the same URL?
ie., Using some server-side code to change what it gives?

As for jPlayer, it will play the URL given to it in the setMedia command. Once it has loaded, then it tends to cache the media, but that is browser dependant and whether the Flash is being used.

Each time you issue the setMedia command, the previous media is cleared. So, if I understand you correctly, you would setMedia to the same URL again and then play it.

Your server response would also have to be correct in order to tell the browser not to cache it. However, I am pretty sure that Chrome freaks out if you disable the cache option and the progress bars stop working.

Best regards,
Mark P.

Mike Hogan

unread,
May 2, 2011, 2:46:33 PM5/2/11
to jPlayer: HTML5 Audio & Video for jQuery
> Each time you issue the setMedia command, the previous media is cleared. So,
> if I understand you correctly, you would setMedia to the same URL again and
> then play it.

Thats the trick - thanks Mark, we're rocking!

Just to answer your Q's - yes, am serving different mp3 each time the
url is called - server side generation.

Keep well,
Mike.
Reply all
Reply to author
Forward
0 new messages