MPMoviePlayerController fullscreen movie inside a UIWebView(UIWebView 中的 MPMoviePlayerController 全屏电影)
问题描述
我遇到了 UIWebView 和 MPMoviePlayerController 的问题:我的 UIWebView 在 html 中有一个电影(它是一个本地 html 文件),我正在使用 html5 和视频的视频标签.问题是:用户可以直接在html上将视频设置为内联播放,也可以点击全屏按钮,但我需要知道视频是否正在全屏播放.
I'm having a problem with the UIWebView and MPMoviePlayerController: My UIWebView have a movie inside the html (it's a local html file), I'm using html5 and a video tag for the video. The problem is: the user can set the video to play inline, directly on the html or he can tap the fullscreen button, but I need to know if the video is playing fullscreen.
我尝试使用 MPMoviePlayerDidEnterFullscreenNotification 但没有成功.
I've tried to use MPMoviePlayerDidEnterFullscreenNotification but with no success.
有人知道如何从 webview 获取此通知吗?
Does anybody know how to get this notification from the webview?
提前致谢
推荐答案
没有发送通知(另见这篇文章:Event on view 显示更改 (Youtube MPMoviePlayerViewController)),但 web 视图会做一些骇人听闻的事情:它将向根 添加一个子视图UIViewController 的
视图,将其设为全屏并在那里播放电影.
There is no notification being sent (also see this post: Event on view displayed change (Youtube MPMoviePlayerViewController)), but the web view will do something hackish: it will add a subview to the root UIViewController's
view, make it full screen and play the movie there.
让你的主 UIViewController's
视图成为你自己的视图,并拦截 -didAddSubview:
和 -willRemoveSubview:
.这样您就可以检测播放器何时被全屏显示.
Make your main UIViewController's
view a view of your own, and intercept -didAddSubview:
and -willRemoveSubview:
. This way you'll be able to detect when the player is brought fullscreen.
这篇关于UIWebView 中的 MPMoviePlayerController 全屏电影的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:UIWebView 中的 MPMoviePlayerController 全屏电影


基础教程推荐
- Android文本颜色不会改变颜色 2022-01-01
- :hover 状态不会在 iOS 上结束 2022-01-01
- 如何使 UINavigationBar 背景透明? 2022-01-01
- LocationClient 与 LocationManager 2022-01-01
- 使用 Ryzen 处理器同时运行 WSL2 和 Android Studio 2022-01-01
- 固定小数的Android Money Input 2022-01-01
- “让"到底是怎么回事?关键字在 Swift 中的作用? 2022-01-01
- 在 iOS 上默认是 char 签名还是 unsigned? 2022-01-01
- Android ViewPager:在 ViewPager 中更新屏幕外但缓存的片段 2022-01-01
- 如何使用 YouTube API V3? 2022-01-01