在 iOS 5 上阻止 AirPlay 镜像

发布于 2024-12-20 06:09:01 字数 163 浏览 1 评论 0原文

在装有 iPad 2 或 iPhone 4S 的 iOS 5 上,用户可以通过 Apple TV 和 AirPlay 启用屏幕镜像。如何防止我的应用程序以这种方式被镜像?有什么方法可以检测到这种镜像的发生,以便我可以阻止我的内容被镜像吗?

这样做的原因是因为我有法律不允许在电视屏幕上显示的内容。

On iOS 5 with an iPad 2 or iPhone 4S, users can enable screen mirroring with their Apple TV and AirPlay. How can I prevent my app from being mirrored in this way? Is there any way to detect that this mirroring is taking place so I can prevent my content from being mirrored?

The reason for doing this is because I have content I'm not legally allowed to display on a television screen.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

水水月牙 2024-12-27 06:09:01

这是一个非常非常糟糕的主意,我讨厌它,因为你抑制了你的用户。也就是说,AirPlay 镜像的工作方式与连接 VGA/HDMI 适配器相同,当您连接适配器时,您可以在“第二个显示器”上显示您想要的任何内容。如果您想“阻止”镜像,您可以将外部显示器的窗口设置为空白/纯黑视图。

大多数 iOS 应用程序在其生命周期内仅创建和使用一个窗口。该窗口跨越设备的整个主屏幕,并在应用程序生命周期的早期从应用程序的主 nib 文件(或以编程方式创建)加载。但是,如果应用程序支持使用外部显示器进行视频输出,则它可以创建一个附加窗口来显示该外部显示器上的内容。所有其他窗口通常由系统创建,并且通常是为了响应特定事件(例如来电)而创建的。

查看 iOS 视图编程指南,特别是Windows 部分和 在外接显示器

This is a really really bad idea and I hate it as you are inhibiting your users. With that said, AirPlay mirroring works the same way as connecting the VGA/HDMI adapter, when you connect an adapter you have the ability to display whatever you want on the "second monitor". If you want to "block" mirroring you could set the external display's window to a blank/solid black view.

Most iOS applications create and use only one window during their lifetime. This window spans the entire main screen of the device and is loaded from the application’s main nib file (or created programmatically) early in the life of the application. However, if an application supports the use of an external display for video out, it can create an additional window to display content on that external display. All other windows are typically created by the system, and are usually created in response to specific events, such as an incoming phone call.

Check out the View Programming Guide for iOS, specifically the Windows section and Displaying Content on an External Display

讽刺将军 2024-12-27 06:09:01

只是在这里添加完成这项非常简单的工作的代码

if ([[UIScreen screens] count] > 1)
    {
        UIScreen *secondScreen = [[UIScreen screens] objectAtIndex:1];
        CGRect screenBounds = secondScreen.bounds;
        UIWindow *secondWindow = [[UIWindow alloc]initWithFrame:screenBounds];
        secondWindow.screen = secondScreen;
        UIView *anyView= [[UIView alloc]initWithFrame:screenBounds];
        anyView.backgroundColor= [UIColor blackColor];
        [secondWindow addSubview:anyView];
    }

Just to add the code for doing this pretty simple work Here

if ([[UIScreen screens] count] > 1)
    {
        UIScreen *secondScreen = [[UIScreen screens] objectAtIndex:1];
        CGRect screenBounds = secondScreen.bounds;
        UIWindow *secondWindow = [[UIWindow alloc]initWithFrame:screenBounds];
        secondWindow.screen = secondScreen;
        UIView *anyView= [[UIView alloc]initWithFrame:screenBounds];
        anyView.backgroundColor= [UIColor blackColor];
        [secondWindow addSubview:anyView];
    }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文