the answer for all question about Oxygen Builder plugin and WordPress

Hey guys,


Hey guys,

I have a video that is being autoplayed inside a modal, the problem is that when the user closes the modal, the sound from the video continues to play.

Any idea how to fix it?

I was using lite-youtube-embed (https://github.com/paulirish/lite-youtube-embed) but also tried with the default oxygen video element with manual iframe.



Source

1 Comment
  1. Robert Chan says

    using html5 video you can do document.getElementById(‘vid’).pause() to pause the video
    document.getElementById(‘vid’).currentTime = 0 to reset the time to 0.

    so your function could pause the video, set timer to 0, then call oxyCloseModal
    then create a close modal button to call that function
    and also override the closing on clicking the background and call the same function.

    you can also use a mutationobserver to watch the modal and stop the video when it is hidden

    both solutions here
    https://jsfiddle.net/pkboy/yfaujsb1/

Leave A Reply

Your email address will not be published.