pichiste
pichiste

Reputation: 1

iOS Safari + Vimeo iframe, detect "Done" button press in native player

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.

Upvotes: 0

Views: 324

Answers (2)

pdkn
pdkn

Reputation: 141

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

Upvotes: 0

Jerred
Jerred

Reputation: 1

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.

Upvotes: 0

Related Questions