Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Marietto2008 opened this issue Aug 18, 2024 · 15 comments
Open

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

Marietto2008 opened this issue Aug 18, 2024 · 15 comments

Comments

@Marietto2008
Copy link

Marietto2008 commented Aug 18, 2024

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
Copy link
Collaborator

rom1v commented Aug 18, 2024

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
Copy link
Author

Marietto2008 commented Aug 18, 2024

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
Copy link
Collaborator

rom1v commented Aug 19, 2024

For mirroring views with secure flag set, read: #4821 (comment)

Also, FYI: #36 (comment)

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
Copy link
Author

Marietto2008 commented Aug 19, 2024

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
Copy link
Author

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

@rom1v
Copy link
Collaborator

rom1v commented Aug 20, 2024

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: #5216 (comment)

Secure flag is enforced for shell user since Android 12: #2129

@Marietto2008
Copy link
Author

Marietto2008 commented Aug 20, 2024

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

#2129 (comment)

?

is it enough ? or it will not work anyway ?

@rom1v
Copy link
Collaborator

rom1v commented Aug 20, 2024

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:

// Since Android 12 (preview), secure displays could not be created with shell permissions anymore.
// On Android 12 preview, SDK_INT is still R (not S), but CODENAME is "S".
boolean secure = Build.VERSION.SDK_INT < Build.VERSION_CODES.R || (Build.VERSION.SDK_INT == Build.VERSION_CODES.R && !"S".equals(
Build.VERSION.CODENAME));
return SurfaceControl.createDisplay("scrcpy", secure);

There's nothing more to do.

@Marietto2008
Copy link
Author

--> There's nothing more to do

what this means ? Your last patch works or not ?

@rom1v
Copy link
Collaborator

rom1v commented Aug 20, 2024

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
Copy link
Author

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

@rom1v
Copy link
Collaborator

rom1v commented Aug 20, 2024

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
Copy link
Author

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
Copy link
Collaborator

rom1v commented Aug 20, 2024

Yes.

Also, you mentioned that you are using Magisk. If you follow the link in a previous comment (#4821 (comment)), you'll find that Magisk has a module to disable secure flag (apparently, I have never used Magisk).

@Marietto2008
Copy link
Author

Marietto2008 commented Aug 21, 2024

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/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants