Stop playing video when modal is closed

Home Forums Community Forum Stop a self hosted video when closing a modal

Search for:

Tagged:modal, javascript, html5 video, stop video

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • dunn123
    Participant
    November 18, 2020 at 3:21 pm
    Post count: 1
    #819423

    Anyone know how to stop a self-hosted video from playing in a modal when the modal is closed.

    I have tried api_params=&enablejsapi=1 but I am presuming this is a YouTube element as it has no effect on a self-hosted video.

    Thanks

    marklchaves
    Participant
    November 19, 2020 at 9:38 am
    Post count: 829
    #819878

    Hi @dunn123,

    Youll need to have a JavaScript function to stop the video. Then, you should be able to add an event listener to the modals close button to call the stop function when the close button is clicked.

    Heres a demo.

    Shout if you have any questions.

    Cheers,

    mark

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In
Username:
Password:
Keep me signed in
Log In
Was this topic helpful?
YESNO
Submitting your vote...Thank you for your vote!
{+votes}{-votes}