0

I want to have a html5 audio player that plays a shoutcast stream with no cache. I've tried the answer given here Link and tried to load the stream with a php file,

But it doesn't work for me, what am i doing wrong? So the script i use is below...

<audio id="audio" autoplay="" controls="" src="<shoutcast ip>+<port>/stream.mp3" type="audio/mpeg"></audio>

and script:

    document.getElementById('audio').addEventListener("ended",function() {
    this.src = "<shoutcast ip>+<port>/stream.mp3?nocache="+new Date().getTime();
    this.play();
});
Jannes
  • 1
  • 4
  • If the file src is accessible to the Client through HTML or JavaScript, they have access to it anyways. – StackSlave May 21 '18 at 22:59
  • sorry, i meant the player works, but the part +new Date().getTime(); doesnt work – Jannes May 22 '18 at 10:06
  • Try `Date.now()`, without `new`. – StackSlave May 22 '18 at 10:41
  • No luck, still loads the normal source without cache busting – Jannes May 22 '18 at 11:32
  • can this (cache busting) also be done in the – Jannes May 22 '18 at 22:20
  • If you use a `.php` src, that should not be cashed. Just save the audio file as `.php` instead of its regular file extension. – StackSlave May 23 '18 at 08:06

0 Answers0