OK, thanks for that. will give it a go.
On 3/04/2016 6:55 AM, Klaus Johannes Rusch wrote:
On 2016-04-02 10:49, Nick Allan wrote:
I've got a greasemonkey script that needs to play an audio file
fairely regularly. Is there any way I can tell greasemonkey to play
the audio from the local hard drive
You should be able to play audio files from local file:/// URLs as well.
I've got the following code that currently plays the audio from a URL
but it introduces a slight delay and I'd rather pre-load it locally
if I can.
Pre-load the audio file when the script loads
var player = document.createElement('audio');
player.preload = 'auto';
player.src = 'https://website.com/alert.wav';
then only run player.play() when you want to play the sound. As long
as the audio file is cachable it should play without delay (tried this
with a sample file from http://freewavesamples.com/ and the audio
played immediately).
--
You received this message because you are subscribed to the Google Groups
"greasemonkey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/greasemonkey-users.
For more options, visit https://groups.google.com/d/optout.