After this modification, you will rarely if ever have to clear your cache to play a song.
Basically, we are going to salt the URL passed to the player in playlist.jsp.
Because the cache stores separate info for each unique URL, this will prevent the cache from re-caching the same URL over and over, which is what causes the problem in the first place.
We are going to edit playlist.jsp.
Here is the part of the file we are going to edit:
- Code: Select all
function skip(index) {
if (index < 0 || index >= songs.length) {
return;
}
var song = songs[index];
currentStreamUrl = song.streamUrl;
updateCurrentImage();
var list = new Array();
list[0] = {
file:song.streamUrl,
title:song.title,
provider:"sound"
};
if (song.duration != null) {
list[0].duration = song.duration;
}
if (song.format == "aac" || song.format == "m4a") {
list[0].provider = "video";
}
player.sendEvent("LOAD", list);
player.sendEvent("PLAY");
}
All you have to do, is replace it with this:
- Code: Select all
function skip(index) {
if (index < 0 || index >= songs.length) {
return;
}
var song = songs[index];
var saltedUrl = song.streamUrl + "&salt=" + Math.floor(Math.random()*100000);
currentStreamUrl = song.streamUrl;
updateCurrentImage();
var list = new Array();
list[0] = {
file:saltedUrl,
title:song.title,
provider:"sound"
};
if (song.duration != null) {
list[0].duration = song.duration;
}
if (song.format == "aac" || song.format == "m4a") {
list[0].provider = "video";
}
player.sendEvent("LOAD", list);
player.sendEvent("PLAY");
}
That will append a parameter named "salt" to the end of the URL and the value of the parameter will be picked randomly.
Hope this helps!