Old 2nd April 2018, 18:32   #1
Jannes01
Junior Member
 
Join Date: Aug 2017
Posts: 11
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?
Jannes01 is offline   Reply With Quote
Old 2nd April 2018, 21:56   #2
djSpinnerCee
Forum King
 
djSpinnerCee's Avatar
 
Join Date: Aug 2004
Location: Hollis, Queens/The Bronx, NYC
Posts: 3,478
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.
djSpinnerCee is offline   Reply With Quote
Old 3rd April 2018, 18:58   #3
Jannes01
Junior Member
 
Join Date: Aug 2017
Posts: 11
Ok thanks but, how can i achieve the same thing on my website, so visitors also don't have a caching webplayer.
Jannes01 is offline   Reply With Quote
Old 24th April 2018, 11:49   #4
Jannes01
Junior Member
 
Join Date: Aug 2017
Posts: 11
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.
Jannes01 is offline   Reply With Quote
Old 15th June 2018, 15:48   #5
knklsturgis
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:
function GetAgentToken() {
return 'xxxxxxxxxxxxxxxxxxxx'.replace(/x/g, function (c) { return ((Math.random() * 16) | 0).toString(16) });
}

knklsturgis is offline   Reply With Quote
Old 15th June 2018, 15:57   #6
knklsturgis
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:
<meta http-equiv="Pragma" content="no-cache">
knklsturgis is offline   Reply With Quote
Old Today, 05:40   #7
Ashton14
Junior Member
 
Join Date: Sep 2018
Posts: 2
I guess it is a simple javascript procedure and yes no-cache tag will help. I needed help with HTML5 player on my website too, but i hired a developer from https://www.netguru.co/services/progressive-web-apps may be you can do the same.
Ashton14 is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > SHOUTcast > SHOUTcast Site Design

Tags
html5 audio nocahce cache

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump