0

I have a Vimeo iframe embed on a mobile site, and am trying to figure out how to detect when the user presses the "Done" button in the native iOS Safari video player.

I know this is possible with the "webkitendfullscreen" event if you are embedding with a video tag directly (as described here):

$('video').bind('webkitendfullscreen', function()
{ 
    console.log('on webkit close'); 
});

However, the video object is not accessible in the case of a foreign iframe embed.

Community
  • 1
  • 1
pichiste
  • 1
  • 3

2 Answers2

0

I have not, so far, been able to find a good way to get this to happen, after quite a lot of keyboard-head-banging. I really hope Vimeo adds a way to do this in the future. The only thing I have found is in their new JS API, there is an event fired when the video has ended, and you can latch on to that and do something if they watch the video all the way to the end. You can also detect when the user pauses the video and do something after a "reasonable" time-frame, depending on what you are trying to do.

My hope was that I would be able to close the corresponding modal window whenever someone closes out of a video, but that was really not a possibility.

Jerred
  • 1
  • 1
  • Sorry, the "ended" event is fired when the video is over (only at the true end of the video), and the "pause" event fires when paused. I used both on my site and mentioned this to Vimeo (so maybe in the future?). The usage is currently found here: [link](https://github.com/vimeo/player.js/blob/master/README.md) – Jerred Feb 26 '18 at 08:11
0

you can use the leavepictureinpicture event

myPlayer.on("leavepictureinpicture", () => console.log("leave pip triggered"));

https://github.com/vimeo/player.js/blob/master/README.md#leavepictureinpicture

pdkn
  • 141
  • 1
  • 2