在屏幕触摸时关闭 MPMoviePlayerController
我遵循了这个 教程,并在我的应用程序中包含一个视频播放器。
但问题是我想隐藏控件,并能够在屏幕触摸上关闭视频。
我尝试在视频前面放置一个大的透明按钮来触发关闭功能,但没有成功。视频将始终位于按钮上方,并且永远不会调用该函数。
还有其他方法吗?
蒂
I followed this tutorial, and included a video player in my app.
But the problem is that i want to hide the controls, and be able to dismiss the video on screen touch.
I tried putting a big transparent button in front of the video that triggers the dismiss function, but with no luck. the video will always be over the button and the function will never be called.
Is there another way of doing it?
ty
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
**嗨,我认为 AVPlayer 变得更适合你,你可以按如下方式使用它,然后如果你想播放则添加子视图,如果你想停止从超级视图中删除它
** #import"AVFoundation/AVFoundation.h"
**用于创建玩家列表:
** 您必须在其中为玩家视图创建 uiview :
**Hi I think AVPlayer is become more suitable to you,You can use it as below and then add subview if you want to play and if you want to stop remove it from super view
** #import"AVFoundation/AVFoundation.h"
**For creating Player List:
** You have to make uiview for playerview in it :
PlayerViewControll .H
PlayerView.M
MainViewControll .H
PlayerView.M
PlayerViewControll .H
PlayerView .M
MainViewControll .H
PlayerView.M
您应该使用 UIGestureRecognizer 类。有关详细信息,请参阅手册。或者阅读本教程。
You should use UIGestureRecognizer class. See manual for details. Or read this tutorial.
使用此代码。
查看确实加载;
并
停止玩家并从视图中释放该玩家。
希望对您有帮助。
Use this code.
in view didload;
And in
stop the player and release this player from view.
Hope it helps you.
我刚刚找到
i just found the solution to my problem in another question asked here.
after some minor modifications, the code worked as expected. thank you all.