使用Safari iOS中的视频回拨“完成”按钮

时间:2012-12-12 22:45:52

标签: ios video safari callback

我想知道,当用户在iPhone上的Safari中观看视频后点击“完成”按钮时,是否有回调?

当视频播放完毕后,有多种方法可以在视频元素上进行回调,但如果视频设置为循环则无法进行回调。在尝试检测用户是否已完成观看视频时,循环会出现问题。

1 个答案:

答案 0 :(得分:1)

有点晚了抱歉:)但这是解决方案:

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);