mercredi 4 février 2015

Is there a way to stop screensaver when audio plays with javascript or jquery

Hi everyone I have a site where I use jplayer to display audio playlists. Everything works great but I was wondering if there was a way with javascript or jquery to prevent the screensaver and the computer from going into sleep mode when the audio is playing. I saw a script that will move the mouse 1px if there is no activity but I would only like this to happen if the audio is playing and when it is not playing I would like everything to go back to normal and allow the screensaver. Is this possible. Here is the script I saw:



#Persistent
SetTimer, MoveMouse

MoveMouse:
If ( A_TimeIdle > 59999 ) {
MouseMove, 1 , 1,, R
MouseMove, -1,-1,, R
}
Return


So like



If
jPlayer({play:function(e){...}})


and then execute some kind of code


I'm not really sure if this will work but I would like it if the script would only activate if jplayer is playing and deactivate if it is not playing. I'm not sure if this is possible but if I could trigger the mouse to move every 5 minutes or something it would be unobtrusive to the user and stop the computer from going into sleep mode. It is just annoying when you set a playlist and then want it to keep playing but your screensaver or sleep mode stops the music. Thanks


Aucun commentaire:

Enregistrer un commentaire