QuickTime Playerを使用してアプリケーションごとに画面の録画やビデオ出力をブロックしたいとします。iOSがQuickTime Playerを使用して画面の録画を検出/ブロックする
私はhdmi出力とairplayをUIScreen
で検出しました。 しかし、QuickTime Playerのビデオ録画は検出されませんでした。
QuickTime Playerの検出方法は?
ありがとうございました。
QuickTime Playerを使用してアプリケーションごとに画面の録画やビデオ出力をブロックしたいとします。iOSがQuickTime Playerを使用して画面の録画を検出/ブロックする
私はhdmi出力とairplayをUIScreen
で検出しました。 しかし、QuickTime Playerのビデオ録画は検出されませんでした。
QuickTime Playerの検出方法は?
ありがとうございました。
このように、QuickTime Playerの記録を検出することはできません。
しかし、私はいくつかのトリックで解決策を見つけました。
QuickTime Playerの録画が実行されている場合、AVAudioSessionの出力ポートタイプはHDMIOutputに変更されています。
次のようにだから私はコーディング...(スウィフト2.2)
func checkOutputPortType() {
let asRoute = AVAudioSession.sharedInstance().currentRoute
for output in asRoute.outputs {
if output.portType == AVAudioSessionPortHDMI {
// something you want..
}
}
}
のviewDidLoadでその機能を挿入し、AVAudioSessionRouteChangeNotification
通知を追加しました。
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(checkOutputPortType), name: AVAudioSessionRouteChangeNotification, object: nil)
ありがとうございます。あなたはAppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
NotificationCenter.default.addObserver(self, selector: #selector(checkIFScreenIsCapture), name: NSNotification.Name.UIScreenCapturedDidChange, object: nil) ......
使用セレクタに通知
NSNotification.Name.UIScreenCapturedDidChange
を使用することができますiOSの11で
func checkIFScreenIsCapture(notification:Notification){
guard let screen = notification.object as? UIScreen else { return }
if screen.isCaptured == true {
}else{
}
}