Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2011
    Posts
    44
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Execute function when play button is clicked in html5 audio player

    Is it possible to detect when the play button in the html5 audio player is clicked? For example:

    Code:
    <audio controls>
        <source src="music.mp3"/>
        <source src="music.ogg" />
    </audio>
    ....
    ....
    $('playbutton').on('click', function(e){
        //some functions
    });

  • #2
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,885
    Thanks
    56
    Thanked 539 Times in 536 Posts
    not sure about the button itself, but there are a range of event listeners available, such as "play" and "playing":
    https://developer.mozilla.org/en-US/...M/Media_events


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •