iOS Safari会在用户点击“完成”时检测到在本地玩家 [英] iOS Safari detect when user clicks "Done" in native player
问题描述
当用户点击原生视频播放器中的完成按钮时,我基本上尝试在Safari iPhone移动浏览器(iOS 7)中打开一个新选项卡。这是行动流程:
I am basically trying to open a new tab in the Safari iPhone Mobile Browser (iOS 7) when the user clicks the "Done" button in the Native video player. This is the action flow:
- 用户播放HTML5视频(点击播放图标)
- 手机Safari打开全屏播放器
3用户点击完成
我尝试了各种方法,这些事件都没有奏效。
I tried various approaches and none of these events are working.
- 已结束
- webkitendfullscreen
- 暂停
关于什么是合适的解决方案的任何想法?如果你想看看我到目前为止所完成的工作,那么代码和JSFiddle链接: http://jsfiddle.net/r8bRE/
Any ideas on on what may be a suitable solution? If you want to check out the work I have done so far here is the code and the JSFiddle Link: http://jsfiddle.net/r8bRE/
<script>
var myVideo = document.getElementById("nVideo");
myVideo.addEventListener("pause", function() {
window.open("http://www.google.com", "_blank");
window.focus();
}, false);
myVideo.addEventListener('webkitendfullscreen', function() {
window.open("http://www.google.com", "_blank");
window.focus();
}, false);
</script>
推荐答案
我在这上面撞了几个小时今天。最初,我正在启动webkitfullscreenchange事件,但它并未在移动设备上触发。最终我发现事件'webkitendfullscreen',在视频关闭时被触发。以下是代码:
I banged my head on this for quite a few hours today. Initially, I was getting the 'webkitfullscreenchange' event to fire, but it was not being triggered on mobile. Eventually I found the event 'webkitendfullscreen', which is fired when the video is closed. Here is the code:
$('video').bind('webkitendfullscreen', function()
{
console.log('on webkit close');
});
希望这会有所帮助。
这篇关于iOS Safari会在用户点击“完成”时检测到在本地玩家的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!