![]() |
#1 |
Junior Member
Join Date: Aug 2017
Posts: 13
|
Shoutcast no cache html5 player
On every SHOUTcast Streams Status (V2) page, there is a html5 webplayer, which has a nocache function.
When you copy the audio link you see something like "/stream?type=http&nocache=376" I also have a html5 audio player on my site, and this one is caching sometimes, So how is this done? I think it is with javascript but i can't find out exactly how to do this? Anyone can help me with this? |
![]() |
![]() |
![]() |
#2 |
Forum King
Join Date: Aug 2004
Location: Hollis, Queens/The Bronx, NYC
Posts: 3,491
|
I would say that each time you load the dnas page the nocache= value is different, that way, your browser will see the url as unique and not attempt to find it in it's cache. the nocache= parameter is most likely ignored by the dnas in returning the actual stream.
/* v2 HTML5 / Player test pages DigitalMixNYC, DigitalMixNYCbx | DNAS Status: Now Playing js codes (scaststatus_X.php) | PortForward.com | Upload/Download Speed Test | No-IP.com: Free Dynamic DNS | In the YP | dnasDir */ |
![]() |
![]() |
![]() |
#3 |
Junior Member
Join Date: Aug 2017
Posts: 13
|
Ok thanks but, how can i achieve the same thing on my website, so visitors also don't have a caching webplayer.
|
![]() |
![]() |
![]() |
#4 |
Junior Member
Join Date: Aug 2017
Posts: 13
|
really no one can help me with this?
I will try to explain it better... On the shoutcast Stream Status page, there is an html5 audio player... when you look at the source code, you will see at the <source src="/stream?type=http&;nocache=Randomnumber I really wanted to know how this is being done, the random number changes every time you refresh so it must being done something like Math.floor(Math.random() * 1000000) Can this be done in the <audio> tag or must it be done with JS? In the JS source i dont see where this must be done. |
![]() |
![]() |
![]() |
#5 |
Junior Member
Join Date: Jun 2018
Posts: 3
|
api nocache
yes its a unique number and yes, it will force the cache to be flushed for the element. This also can be used as a session-less token so that each web user instance that has activated the player can be individually tracked, and logged. The random number is generated in java by this file: https://www.radionomy.com/js/radionomy.api.agentid.js by the fallowing code:
code: |
![]() |
![]() |
![]() |
#6 |
Junior Member
Join Date: Jun 2018
Posts: 3
|
Also, some web browsers will attempt to cache the whole page, that sometimes causes the player to be cached for a few seconds. Placing the no-cache meta tag fixes those browsers:
code: |
![]() |
![]() |
![]() |
#7 |
Junior Member
Join Date: Jan 2019
Posts: 6
|
Try this: ?type=http&nocache='.time().'
|
![]() |
![]() |
![]() |
|
Tags |
html5 audio nocahce cache |
Thread Tools | Search this Thread |
Display Modes | |
|
|