iOS使用QuickTime播放器检测/阻止屏幕录制 [英] iOS detect/block screen recording using QuickTime player

查看:431
本文介绍了iOS使用QuickTime播放器检测/阻止屏幕录制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用QuickTime Player阻止每个应用的屏幕录制或视频输出。

I want to block screen recording or video output per my app using QuickTime Player.

我已经检测到hdmi输出和airplay与 UIScreen
但是没有检测到QuickTime Player视频录制。

I had detected hdmi output and airplay with UIScreen. But QuickTime Player video recording was no detect.

如何检测QuickTime播放器?

How to detect QuickTime Player?

谢谢。

推荐答案

因此不知道检测QuickTime播放器的录音。

Thus don't know detect QuickTime Player recording.

但是我找到了一个解决方法。

But I Found a solution with some trick.

如果正在运行QuickTime Player录制,AVAudioSession的输出portType已更改为HDMI输出。

If QuickTime Player recording is running, AVAudioSession's output portType has been changed to HDMIOutput.

所以我编码如下......(Swift 2.2)

So I coding as follows...(Swift 2.2)

func checkOutputPortType() {
    let asRoute = AVAudioSession.sharedInstance().currentRoute
    for output in asRoute.outputs {
        if output.portType == AVAudioSessionPortHDMI {
            // something you want..
        }
    }
}

在ViewDidLoad中插入该函数并添加 AVAudioSessionRouteChangeNotification 通知。

Insert that function in ViewDidLoad and added AVAudioSessionRouteChangeNotification notification.

NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(checkOutputPortType), name: AVAudioSessionRouteChangeNotification, object: nil)

谢谢。

这篇关于iOS使用QuickTime播放器检测/阻止屏幕录制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆