使用Javascript关闭iPhone视频播放器

使用Javascript关闭iPhone视频播放器

本文介绍了使用Javascript关闭iPhone视频播放器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含多个html5标签的网页,为用户提供了许多可以选择播放的视频的海报/缩略图。当用户触摸其中一个时,iPhone视频播放器将打开并播放视频。我希望能够在视频播放完毕后自动关闭视频播放器并将用户返回到缩略图。

I have a web page with several html5 tags, offering users a number of posters/thumbnails for videos they can choose to play. When a user touches one of the them the iPhone video player opens and the video plays. I want to be able to automatically close the video player after the video has finished and return the user to the thumbnails.

我为已结束设置了事件监听器事件我可以检测到视频已经完成,但我无法弄清楚如何关闭视频播放器并返回缩略图。它只是等待用户触摸完成按钮。有没有办法在Javascript中这样做?

I have set the event listener for the "ended" event and I can detect that the video has finished, but I can't figure out how to close the video player and return to the thumbnails. It just waits for the user to touch the "done" button. Is there any way of doing this in Javascript??

推荐答案

jQuery -

jQuery -

$('video').get(0).webkitExitFullscreen();

不确定支持哪个iOS版本。请参阅正确的方法是webkitExitFullscreen。请参见获得全面支持

Uncertain what iOS version this was supported. See The correct method is webkitExitFullscreen. See https://developer.mozilla.org/en-US/docs/Web/Guide/API/DOM/Using_full_screen_mode for full support

这篇关于使用Javascript关闭iPhone视频播放器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-14 16:30