Limit Button to 6 clicks per hour

dardisintel

Hello,

I am building an internet radio application. I need to limit the skip button to 6 skips per hour.

Every time you skip a song, the number will decrease by one (1), until it reaches zero (0). When reaching 0, a message will appear reminding you that you have exceeded your skip allotment for the hour. As time goes forward, the skip counter will begin counting up, back to 6.

if you have to limit clicks and are not worried about JS being disabled

your job now is to work out how to time limit and stop the window refreshing, that would be something to do with window.onunload

dardisintel

Thank you for your response. Still unclear on how that would work, do you have to use window.onunload to prevent clicks from being reset? Sorry, I don't have much experience writing script.

I'm not too concerned about the user having javascript disabled we can make sure that they know they have to use it.

root

Can you clarify what your aims are in regard to the limitation of clicks, what is it your trying to protect, I ask because JavaScript is not considered in any way, shape or form as a suitable method of protection of anything.

If you can let people reading the thread know what your aims and intentions are, it might help because alternative methods of dealing with your requirements may exist.

dardisintel

What I have is a website that uses a jPlayer to play music. The website will serve as a music solution for establishments and businesses. In order to be legal and limit the user from skipping through the entire playlist the users must not be able to skip songs more than 6 times in an hour. Examples of this can be seen on Slacker and Radio.com's player. Radio.com uses a flash player and Slacker uses some functions built into their player.

Hopefully that clears things up a little.

JMRKER

This is not an entire solution to your problem, but it might give you some ideas...

For testing purposes, the program only allows for 6 clicks within 1 minute (60 seconds) rather than 60 minutes.

Current problem to solve is the case where the use leaves the program
and comes back later or just refreshes the screen.
Boom, the starttime and counter values are reset to their original conditions.

To solve this, I would add some code for a cookie or local storage value that retains the start time.
Then, when the user returns, the saved time value can be used as the start time rather than it being reset.
This logic is NOT included, but cookies and local storage scripts abound on the web.

root

I have never ever in all the years of being around audio heard of a clause for being legal to limit the ability to skip ahead in a track. Could you please cite the source of this legislative requirement?

dardisintel

Pandora, Slacker, Radio dot com, Last.fm, among many other broadcasters abide by this law.

"When you listen to Last.fm radio, there is a limit on the number of times you can skip tracks on each station. It’s a requirement of our licensing agreements that allow us to stream music legally.

\\.\;1292645 wrote:

I have never ever in all the years of being around audio heard of a clause for being legal to limit the ability to skip ahead in a track. Could you please cite the source of this legislative requirement?

dardisintel

Thank you JMRKER, going to test and see what we can do about storing startTime.

root

What you are referring to is a limit imposed by the RIAA, and the limitation IMHO is like most things, orientated towards advertisers not being missed, people do hate adverts and therefore it is quite reasonable to say that if you are carrying paid adverts where you are the revenue earner, then you would have to comply otherwise you could tell the RIAA to whistle.

People often confuse what is the law and what others say is the law and people do not challenge authority enough by asking to be given the legislative passage that gives them the tight to wade in and be the big bully.

You mention that you are using web player that I know carries video... well if you have got video streaming with the audio, your not breaking any laws or rules by allowing people to skip ahead as often as they like, the rules do not apply to video streams. <-- Hint

dardisintel

That doesn't apply here. Bypassing this all together is a nice thought, but unfortunately it's not an option.

dardisintel

Do you think storing the script with basket.js would work for saving the variables? Or would it be better in database?

JMRKER;1292603 wrote:

This is not an entire solution to your problem, but it might give you some ideas...

For testing purposes, the program only allows for 6 clicks within 1 minute (60 seconds) rather than 60 minutes.

Current problem to solve is the case where the use leaves the program
and comes back later or just refreshes the screen.
Boom, the starttime and counter values are reset to their original conditions.

To solve this, I would add some code for a cookie or local storage value that retains the start time.
Then, when the user returns, the saved time value can be used as the start time rather than it being reset.
This logic is NOT included, but cookies and local storage scripts abound on the web.

JMRKER

dardisintel;1293105 wrote:

Do you think storing the script with basket.js would work for saving the variables? Or would it be better in database?

Have not a clue as to what 'basket.js' does.
Not enough information provided.

dardisintel

Sorry, I'm looking for one of these local storage scripts you were talking about?

JMRKER

dardisintel;1293231 wrote:

Sorry, I'm looking for one of these local storage scripts you were talking about?

Alternatively, you could use a cookie script. Google that or see references above.

root

If you are using a video player to play back then you must have a video stream element to it which means that you have no need for a script to stop the user from forwarding.

For complete control including page refreshes, you should look at sessions, store information regarding the number of clicks to fast forward in a session variable and have that value written in to the button clicks left.

dardisintel

You I'm talking about skipping the song entirely NOT skipping ahead in the song right?

\\.\;1293299 wrote:

If you are using a video player to play back then you must have a video stream element to it which means that you have no need for a script to stop the user from forwarding.

For complete control including page refreshes, you should look at sessions, store information regarding the number of clicks to fast forward in a session variable and have that value written in to the button clicks left.

dardisintel

For anyone looking to limit the number of allowed skips using jPlayer.

You can access last_clicks, max_clicks, and time_for_max_clicks inside your main .js file.