相关疑难解决方法(0)

如何使用 AVPlayerViewController 检测播放控件显示的切换?

我想知道是否可以检测播放控件何时从 AVPlayerViewController 视图中出现或消失。我正在尝试在我的播放器上添加一个 UI 元素,该元素必须遵循播放控件显示。仅在显示控件时出现,否则消失

我似乎没有找到任何可以在 AVPlayerViewController 上观察到的值来实现这一点,也没有任何回调或委托方法。

我的项目在 Swift 中。

ios avplayer swift avplayerviewcontroller

9
推荐指数
1
解决办法
646
查看次数

AVPlayer UITapGestureRecognizer无法正常工作

我有这个代码AVPlayerViewController.

UITapGestureRecognizer *tap=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tapAvPlayer)];
[self.avPlayerViewController.view addGestureRecognizer:tap];
Run Code Online (Sandbox Code Playgroud)

但这不起作用..:S,我尝试过设置

[self.avPlayerViewController.view setUserInteractionEnabled:YES];
Run Code Online (Sandbox Code Playgroud)

仍然没有好......

唯一可行的解​​决方案是使用UIGestureRecognizer并实现它的shouldReceiveTouch委托并检查av播放器是否被触摸..但问题是,我们不想捕获"轻敲释放"事件..因为如果av player只是触摸了视图,它立即执行代码,这不是我们想要的......

请帮我们解决这个问题..

谢谢!

iphone objective-c ios uitapgesturerecognizer avplayerviewcontroller

8
推荐指数
3
解决办法
4546
查看次数