在iPad上暂停HTML5 YouTube视频

时间:2021-10-17 19:01:09

I am developing an iPad app that embeds YouTube videos in HTML5 format into a UIWebView. The problem is that I want to pause the video when a user brings up modal dialog windows, rather than clear or stop the video as many have suggested. This is critical to a good user experience. Does anyone know any JavaScript or API that I can run to simply pause the video when an action that presents a modal dialog will occur?

我正在开发一个iPad应用程序,将HTML5格式的YouTube视频嵌入到UIWebView中。问题是我想在用户调出模态对话窗口时暂停视频,而不是像许多人建议的那样清除或停止视频。这对良好的用户体验至关重要。当出现模态对话框的动作发生时,有没有人知道我可以运行的任何JavaScript或API来简单地暂停视频?

The method I use to embed is described here. http://apiblog.youtube.com/2010/07/new-way-to-embed-youtube-videos.html

这里描述了我用来嵌入的方法。 http://apiblog.youtube.com/2010/07/new-way-to-embed-youtube-videos.html

2 个解决方案

#1


0  

This blog explains hot to build a video in HTML 5.
http://blog.steveheffernan.com/2010/04/how-to-build-an-html5-video-player/

这篇博客解释了用HTML 5构建视频的热点.http://blog.steveheffernan.com/2010/04/how-to-build-an-html5-video-player/

Then interact with the video player via the method [myWebView stringByEvaluatignJavaScriptFromString:@"playVideo()"].

然后通过方法[myWebView stringByEvaluatignJavaScriptFromString:@“playVideo()”]与视频播放器进行交互。

I didn't tested but it seems straightforward.

我没有测试,但似乎很简单。

Are you sure we can play embedded YouTube videos in mobile Safari?

您确定我们可以在移动版Safari中播放嵌入的YouTube视频吗?

Good luck!

祝你好运!

#2


0  

Have you tried going through official docs? http://developer.apple.com/library/safari/#documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/ControllingMediaWithJavaScript/ControllingMediaWithJavaScript.html

你试过通过官方文档吗? http://developer.apple.com/library/safari/#documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/ControllingMediaWithJavaScript/ControllingMediaWithJavaScript.html

#1


0  

This blog explains hot to build a video in HTML 5.
http://blog.steveheffernan.com/2010/04/how-to-build-an-html5-video-player/

这篇博客解释了用HTML 5构建视频的热点.http://blog.steveheffernan.com/2010/04/how-to-build-an-html5-video-player/

Then interact with the video player via the method [myWebView stringByEvaluatignJavaScriptFromString:@"playVideo()"].

然后通过方法[myWebView stringByEvaluatignJavaScriptFromString:@“playVideo()”]与视频播放器进行交互。

I didn't tested but it seems straightforward.

我没有测试,但似乎很简单。

Are you sure we can play embedded YouTube videos in mobile Safari?

您确定我们可以在移动版Safari中播放嵌入的YouTube视频吗?

Good luck!

祝你好运!

#2


0  

Have you tried going through official docs? http://developer.apple.com/library/safari/#documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/ControllingMediaWithJavaScript/ControllingMediaWithJavaScript.html

你试过通过官方文档吗? http://developer.apple.com/library/safari/#documentation/AudioVideo/Conceptual/Using_HTML5_Audio_Video/ControllingMediaWithJavaScript/ControllingMediaWithJavaScript.html