How to stop an embedded Vimeo video when you hide the object

bcalhoun4409
bcalhoun4409 Community Member Posts: 1
We embed Vimieo videos into our courses using the the embedded code in an HTML Extension.  This works great, however, we are now doing a course where we have 2 videos on one page.  When you click a button video1 appears and you can click the play button on the video.  If you click button2 video1 will hide and video2 will appear.  The issue is that when we hide the HTML Extension (video1) the video doesn't show, but the audio keeps playing.  Anyone know how to stop the video when you hide the HTML object?

Comments

  • wheels
    wheels Community Member, Administrator, Moderator, Rockstar Manager Posts: 530 eLearning ROCKSTAR Admin Team
    This is a BIG guess but hopefully it will just work!

    On the first Vimeo external HTML object add these two actions:

    Action -> On Page Show -> RunJavaScript

    getDisplayWindow().vimeoVideo1 = %HTMLNAME%;

    Action -> On Hide -> RunJavaScript

    triv$('iframe', getDisplayWindow().vimeoVideo1.div)[0].contentWindow.postMessage('pause', '*');


    If it doesn't it would help if you can post an example title or publish to a public area where we can try it!

    Thanks,

    Joe
  • timk
    timk Community Member Posts: 1,176 ☆ Superstar ☆
    Vimeo provides a Javascript API that lets you control the videos. I produced a simple example:

    https://community.trivantis.com/shared-content/how-to-control-vimeo/

    Much more than that is possible.
  • wheels
    wheels Community Member, Administrator, Moderator, Rockstar Manager Posts: 530 eLearning ROCKSTAR Admin Team
    That's awesome @timk if we implement a vimeo object I'll be calling you!
Sign In or Register to comment.

So You Wanna Be An eLearning ROCKSTAR?

We're all fans of eLearning here! Want to become an eLearning ROCKSTAR? Just click on one of the buttons below to start your rocking journey!