PricingBlog

How do I play / pause an audio component on click?

  • lucingrey-1242255168075075696

    Grey

    1 year ago

    Currently I have the on click event to toggle show / hide a play / stop button but I don't see the event play / pause for the audio as it does in html. So how would I get access to these components' events?
  • jacobkofoed-1242398179882831944

    Jacob Kofoed

    1 year ago

    If you're using @Andreas Møllers package https://editor.nordcraft.com/projects/web_media/branches/main/components/HomePage then you can use the actions playMedia & pauseMedia within a workflow. A workflow is the window you get from a click event etc. Just remember to reference your element by its ID.

    If you want to listen to changes to the media, and you don't see the event-type in the events panel, then you can click the little "+" plus-sign in the bottom of the event-panel where it says "Other". You can then manually add play and pause to the media element to perform a workflow when the user play or pause. There are a some more events for just the <video> element https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video

    I hope I understood your question correct, otherwise let me know 👍
    1242398179992014899-CleanShot_2024-05-21_at_10.43.33.png
    1242398180243537920-CleanShot_2024-05-21_at_10.43.52.png