阻止其他应用程序形成 capturing/recording 屏幕

Prevent other applications form capturing/recording screen

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

我的应用程序有视频流,我想保护我的视频流不受其他应用程序的影响。当我的视频正在播放时,其他应用程序应该无法捕获屏幕。任何建议我如何实现这一点..提前致谢。

尝试将此添加到您的 Activity

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

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

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

勾选 this link 表示

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.

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

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

写在上面setContenView();

它只阻止快照捕获。并且还会阻止视频捕获。但对于视频捕获其设备特定。