如何在图片模式下开始图片而不是进入背景?像YouTube Premium
我知道当应用程序正常运行时,如何启用图片中的图片模式本身,但是问题在于,当应用程序转到AcrackeD Mode IE时,我想激活它。 这种行为的一个很好的例子是Android上的YouTube Premium应用程序。当视频播放时,用户点击“主页”按钮时,视频只是在PIP模式下继续播放。 我尝试实现LifeCycleObserver,并从其“ OnPause”回调中启动图片中的图片模式。但是它说“必须恢复活动才能进入图片中”。 我在OnPope方法中查看了一个,它以Super.Onpause()的方式实现,因此我不能仅仅覆盖它,也不能称为“ Super”。
有人对如何实施这种类似YouTube的行为有任何建议吗? PS我在问这个之前已经搜索了很多
I know how to enable picture-in-picture mode itself when an app runs normally but the problem is that I want to activate it when the app goes to background mode i.e. on activity pause.
A good example of such behavior is YouTube premium app on android. When a video is playing and a user taps "home" button the video just keeps on playing in PIP mode.
I tried to implement LifecycleObserver and launch picture-in-picture mode from its "onPause" callback. But it says "activity must be resumed to enter picture-in-picture".
I took a look inside onPause method and it's implemented in a way that super.onPause() must be called first, so I can't just override it and not to call "super".
Does anyone have any suggestion on how implement this Youtube-like behavior?
p.s. I've googled a lot before asking this
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
文档为此提供了一个示例:
https> https:// deverseer。 android.com/guide/topics/ui/picture-in-picture#pip_button
The docs provide an example for this:
https://developer.android.com/guide/topics/ui/picture-in-picture#pip_button