Benjamin Allison
Benjamin Allison

Reputation: 2154

Callback for "done" button with videos in Safari iOS

I'm wondering, is there a callback for when the user, after viewing a video in Safari on the iPhone, hits the "Done" button?

There are ways to get a callback on the video element when a video finished playing, but not if a video is set to loop. Looping poses a problem when trying to detect whether a user has finished watching a video.

Upvotes: 2

Views: 1209

Answers (1)

Magico
Magico

Reputation: 2804

a bit late sorry :) but this is the solution:

player = document.getElementById('videoplayer');

//when a user press DONE or PAUSE the first time is triggered the paused event so you can control with:
player.addEventListener("pause", function() {
   //desired "done or puase button" behavior defined here
}, false);

//this is triggered when exit the fullscreen, or for example whrn the user First press PAUSE and THen press DONE

player.addEventListener('webkitendfullscreen', function() {
   //desired "done button" behavior defined here
}, false);

Upvotes: 1

Related Questions