有没有办法在 iPhone 上捕获 HTML5 视频事件?
我有我的标准视频标签,可以在 Chrome 中正常播放;
<video width="x" height="y" src="video.mp4"></video>
视频本身在 iPhone 上播放得很好,但是没有办法监听事件吗?有什么活动吗?我想使用“结束”事件,但即使是“点击”或“播放”也会有帮助!
该标准
video.addEventListener('ended', function() {
alert('this adds nothing');
}, false);
根本不起作用,我也无法跟踪视频标签上的点击事件(以相同的方式)。
如果没有,是否可以在视频顶部添加透明,正常跟踪单击事件,然后触发视频的播放事件,以便视频正常加载到单独的窗口中?
I have my standard video tag which is playing fine in Chrome;
<video width="x" height="y" src="video.mp4"></video>
The video itself plays fine on the iPhone, however, is there no way to listen for events? Any kind of event? I'd like to use the 'ended' event, but even a 'click' or 'play' would be helpful!
The standard
video.addEventListener('ended', function() {
alert('this adds nothing');
}, false);
doesn't work at all, and nor can I track a click event (In the same way) on the video tag.
If not, would it be possible to perhaps add a transparent over the top of the video, track a click event to that as normal but then fire the play event for the video so that the video loads in the separate window as normal?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这非常适合我在 iphone/ipad/safari/chrome 上使用
This works perfectly for me on an iphone/ipad/safari/chrome
以下是 Safari HTML5 音频和视频的示例指南
Here is an example from Safari HTML5 Audio and Video Guide