简体   繁体   English

以编程方式启用画中画模式

[英]Enable Picture in Picture mode programmatically

I'm making a settings activity in my Android video playback app and I want to know if it was possible to enable/disable PIP(Picture-in-Picture) mode programmatically. 我正在Android视频播放应用程序中进行设置活动,我想知道是否可以通过编程方式启用/禁用PIP(画中画)模式。

To clarify I am fully aware that this setting can be change via application advanced settings or via special app access, but I want to leave that as a last resort. 为了明确起见,我完全知道可以通过应用程序高级设置或通过特殊的应用程序访问来更改此设置,但是我想把它留作最后的选择。 (If there are no other alternatives). (如果没有其他选择)。

Further more this Activity is isolated from the video threading page itself.(Meaning the user would have to stop the video entirely before coming to this page). 此外,该活动与视频线程页面本身是隔离的(意味着用户在进入此页面之前必须完全停止视频)。

Main reasons I want this is an extra reminder that this app supports this feature and also if the user forgets where to reactivate this function. 我想要此功能的主要原因是在提醒您此应用程序支持此功能,并且如果用户忘记了在何处重新激活此功能。

Think of it as: Adding another layer of user friendliness 认为是:添加了另一层用户友好性

Here is a way to check the setting: 这是一种检查设置的方法:

AppOpsManager appOpsManager = (AppOpsManager) context.getSystemService(Context.APP_OPS_SERVICE);
return (AppOpsManager.MODE_ALLOWED == appOpsManager.checkOpNoThrow(AppOpsManager.OPSTR_PICTURE_IN_PICTURE,
        context.getApplicationInfo().uid, context.getPackageName()));

I haven't tried setting it programmatically, but this could be a starting point for you. 我没有尝试以编程方式设置它,但这可能是您的起点。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM