Jump to content

Recommended Posts

Using an html5 audio tag, I want to trap when a user clicked play, and when (or if) a user clicked stop.

 

This is what I have

 

 

 

In my php :

<audio controls="controls" name="audio_player" id="audio_player" onclick="javascript: test_for_play(this);">
<source src="audio_upload/' . $filename . '" type="audio/mpeg" />
'.$audio_ABC_html.'
</audio>

 

And in the head I have :

 

<script type="text/javascript">

function test_for_play(var name) {
   window.alert('Message goes here');
}

</script>

 

But I don't ever get the pop up? I'm doing one thing at a time, and I can't move forward until I get this function firing when the user clicks a button on the audio tag.

 

Thanks for the help!

 

Nick

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.