Ive read the forums but can seem to get this to work…
I have a hype doc with a number of scenes and there is embedded Vimeo video on at least 6 of them
I have a button that overlays the video to show a text version only and I want the video to pause at that point as well as on scene unload.
The one I got partially working was by using this in the html head
and this js function
var videoRectangle = hypeDocument.getElementById(‘videoRectangle’)
var iframe = videoRectangle.childNodes[0];
var player = $f(iframe);
player.api("pause");
I given the video element a unique id of videoRectangle
I had it working intermittently on one video but not across the scenes where I need the videos to pause when the text only button is selected or the scene unloaded
presuppose that you scriptlines work for one instance, you can make it working for reuse by using a class instead of id for the video and the sceneelement as root.
var sceneElement = document.getElementById(hypeDocument.currentSceneId());
var videoRectangle = sceneElement.querySelector('.videoRectangle');
var iframe = videoRectangle.childNodes[0];
var player = $f(iframe);
player.api("pause");