Hi!
I have been working on a project where I need to have a clean play button that when clicked enters fullscreen and starts playing video, then when exiting fullscreen video needs to automatically pause.
So far I have been able to use the play button to enter fullscreen and start playing the video, but now trying to figure out how to implement the second part - auto-pause video when exiting fullscreen.
Working with custom code is rather new for me, so any help is really appreciated. Thanks!
Code I’m using right now:
<script src="https://player.vimeo.com/api/player.js"></script>
<script>
var Webflow = Webflow || [];
Webflow.push(function () {
// DOMready has fired
// May now use jQuery and Webflow API
var iframe = document.querySelector('iframe');
var player = new Vimeo.Player(iframe);
$('#btnPlay').click(function() {
player.play();
player.requestFullscreen();
});
});
</script>
Here is my site Read-Only: [LINK][1]
Published test page: LINK 2