简体   繁体   English

在AVPlayerViewController中点击播放按钮时执行操作

[英]Perform action when play button is tapped in AVPlayerViewController

I am using AVPlayerViewController to play video. 我正在使用AVPlayerViewController播放视频。 When play button is tapped in AVPlayerViewController I need to perform some action. 当在AVPlayerViewController点击播放按钮时,我需要执行一些操作。 But I can't detect whether play button is tapped. 但我无法检测是否点按了播放按钮。 Here is a picture for better understanding. 这是一张更好理解的图片。 在此输入图像描述

Any assistance would be a great help. 任何援助都将是一个很大的帮助。

Officially there is not any Done Button click event. 官方没有任何完成按钮点击事件。

What you could do is associate a UITapGestureRecognizer with the view of the AVPlayerViewController, allowing the "menu" press type, and cancelling touches in view. 你可以做的是将UITapGestureRecognizer与AVPlayerViewController的视图相关联,允许“菜单”按下类型,并取消视图中的触摸。 Your selector callback will then be responsible for handling the pausing of playback and the dismissal of the AVPlayerViewController, but it would also allow you to perform any other cleanup required specific to your implementation. 然后,您的选择器回调将负责处理暂停播放和解除AVPlayerViewController,但它还允许您执行特定于您的实现所需的任何其他清理。

Alternatively you can follow it . 或者你也可以关注 Its smart workaround. 它的智能解决方案。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM