Genymobile / scrcpy

Display and control your Android device
Apache License 2.0
111.14k stars 10.65k forks source link

No video (black screen) with Now TV Android app... #5216

Open Marietto2008 opened 2 months ago

Marietto2008 commented 2 months ago

Hello to everyone.

I've connected scrcpy via wi-fi because I wanted to share and control Android (14,installed on the Raspberry Pi 4) through my PC (where I have installed Ubuntu 24.04). Android is connected to the Internet via WI-FI. Ubuntu 24.04 is connected also via WI-FI. The ultimate goal is to be able to watch NowTV on my main room,because I keep my Raspberry Pi 4 + Android in another room,where I don't live so much,because it's small and uncomfortable. I live in a larger room. I have an account with NowTV and I want to watch the good sport events they offer. For this reason I chosen scrcpy to mirror the content of the screen attached to the Raspberry to the screen that I use usually on the main room via wi-fi. Unfortunately,it does not work. The video stream from Android app Now TV appears black on the monitor attached to my PC and connected via wi-fi with Android and scrcpy. Everything else in-app (Now TV app) appears fine on the monitor attached to the Rasp.

Is there something we can do to fix the problem ? I think that it falls under my rights to watch the contents of NowTV on one only device (the raspberry Pi) even if I'm using two monitors. I don't see any law infringement,any piracy action. Instead,I see that one of my rights is violated. And I also see a bug in scrcpy,something that's broken and need to be fixed.

rom1v commented 2 months ago

Secure flag is enforced for shell user since Android 12: #2129, so there's no way to mirror apps that refuse to be mirrored (without root).

Anyway, if the video of your app has DRM, it would not work anyway.

Marietto2008 commented 2 months ago

I've rooted Android with Magisk. Is perfectly legal to forbid me to mirror DRM contents on another screen ? Is perfectly legal to forbid me to watch NowTV on Linux ? Yes,because it does not work there. If scrcpy is not able to reproduce DRM contents,doesm't it have a problem that requires a patch ? Are you throwing the sponge ?

rom1v commented 2 months ago

For mirroring views with secure flag set, read: https://github.com/Genymobile/scrcpy/issues/4821#issuecomment-2041050950

Also, FYI: https://github.com/Genymobile/scrcpy/issues/36#issuecomment-726280184

For video with DRM, I have no technical solution to mirror them within scrcpy.

Is perfectly legal to forbid me to mirror DRM contents on another screen ? Is perfectly legal to forbid me to watch NowTV on Linux ?

You should complain to "NowTV" (whatever it is), not scrcpy.

Marietto2008 commented 2 months ago

On my old tablet Nexus 10,running with Android 5.1,I've tried to share and control the screen with scrcpy (version. 1.25) with the USB cable and...it worked...I don't see the black screen : I can mirror the NowTV contents on the screen attached to the PC where I have installed Ubuntu 24.10. Do you think that it will work also with the newest version of scrcpy ? Its interesting to try. If it will not work,scrcpy will need to be fixed,because I have excluded that the cause is Android and / or the NowTV app (I'm talking for Android 5.1 only). Anyway, I suspect that from one Android version to another a new security component has been added to Android.

Marietto2008 commented 2 months ago

Scrcpy 2.6.1 works great with Android 5.1. Do you know until which Android version it works great ?

rom1v commented 2 months ago

Do you know until which Android version it works great ?

Yes, until Android 11, because on Android 12 views with secure flags enabled cannot be mirrored by shell user: https://github.com/Genymobile/scrcpy/issues/5216#issuecomment-2295394491

Secure flag is enforced for shell user since Android 12: https://github.com/Genymobile/scrcpy/issues/2129

Marietto2008 commented 2 months ago

Let me understand. To fix the problem on Android 12 I should recompile scrcpy applying this patch :

https://github.com/Genymobile/scrcpy/issues/2129#issuecomment-781665069

?

is it enough ? or it will not work anyway ?

rom1v commented 2 months ago

Let me understand. To fix the problem on Android 12 I should recompile scrcpy applying this patch

No.

Initially, scrcpy always requested to also capture "secure content". But since Android 12, doing that caused an exception to be thrown, because Android started refusing to capture secure content from shell user.

Therefore, the fix to avoid the error was to NOT request secure content for Android >= 12: https://github.com/Genymobile/scrcpy/blob/44b3fd82b1831f4aa436268870adf32bddb81924/server/src/main/java/com/genymobile/scrcpy/video/ScreenCapture.java#L104-L108

There's nothing more to do.

Marietto2008 commented 2 months ago

--> There's nothing more to do

what this means ? Your last patch works or not ?

rom1v commented 2 months ago

The patch was to make scrcpy work for Android 12 (but disabling "secure content" mirroring, so it displays a black screen instead), because otherwise, scrcpy could not be started at all.

But "secure content" cannot be mirrored.

Marietto2008 commented 2 months ago

Do you suggest me to patch scrcpy anyway for the Android versions minor than 12 ?

rom1v commented 2 months ago

Do you suggest me to patch scrcpy anyway for the Android versions minor than 12 ?

To patch it with what? The fix for #2129 has already been merged for a long time. And it works (and continue to mirror "secure content") for Android lower than 12.

Marietto2008 commented 2 months ago

A stupid question : can Android 12 be recompiled applying to its source code the patch needed to disable secure flags ? Isn't the source code of Android open source ?

rom1v commented 2 months ago

Yes.

Also, you mentioned that you are using Magisk. If you follow the link in a previous comment (https://github.com/Genymobile/scrcpy/issues/4821#issuecomment-2041050950), you'll find that Magisk has a module to disable secure flag (apparently, I have never used Magisk).

Marietto2008 commented 2 months ago

Thanks Romain. It works,but something is not good with the module. When I launch scrcpy,the content on the scrcpy screen starts to go very slowly. I've got the magisk module here : https://www.magiskmodule.com/disable-flag-secure-magisk-module/