编程语言
首页 > 编程语言> > android – 防止其他应用程序形成捕获/记录屏幕

android – 防止其他应用程序形成捕获/记录屏幕

作者:互联网

基本上我想要视频盗版保护

我的应用程序有视频流,我想保护我的视频流免受其他应用程序的影响.其他应用程序不应该在播放视频时捕获屏幕.任何建议我怎么能实现这一点..在此先感谢.

解决方法:

您可以通过在Activity中添加FLAG_SECURE来保护屏幕捕获功能,如下所示

  getWindow().setFlags(LayoutParams.FLAG_SECURE, LayoutParams.FLAG_SECURE); 

检查this链接说

Screen capturing and sharing

Android 5.0 lets you add screen capturing and screen sharing
capabilities to your app with the new android.media.projection APIs.
This functionality is useful, for example, if you want to enable
screen sharing in a video conferencing app.

The new createVirtualDisplay() method allows your app to capture the
contents of the main screen (the default display) into a Surface
object, which your app can then send across the network. The API only
allows capturing non-secure screen content, and not system audio. To
begin screen capturing, your app must first request the user’s
permission by launching a screen capture dialog using an Intent
obtained through the createScreenCaptureIntent() method.

this link的文件也说明了这一点

Window flag: treat the content of the window as secure, preventing it
from appearing in screenshots or from being viewed on non-secure
displays.

以上解决方案肯定会阻止应用程序捕获您的应用程序的视频

标签:recording,android,screen,capture
来源: https://codeday.me/bug/20190930/1836104.html