keijiro / KlakNDI

NDI® plugin for Unity

Home Page:https://ndi.video

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Android receiver return black screen

tomsuperman opened this issue · comments

Hi,
Thanks for this amazing plugin.
 
I tried to implement the Android NDI Receiver followed with the instruction. The Receiver works fine with my Samsung s10e. However, I recently updated my phone with OS update, the App returned the black screen without any video output. I check the Android Studio, there was no errors or warnings. It seems it cannot initiated the NDI network to find any sender signal. I do not know if this is anything to do with the latest update with Android. Any instruction will be much appreciated.

to add more clarifications, the Plugin works great on iOS.

Could you try wired connection using USB-ethernet adapter or something like that?

Thanks for the reply. I just did plug in a USB-ethernet adapter, but still black screen. I did try to add the dropdown to list the OBS senders which works in the Editor. But no items were listed in Android.

to Update. I tried to find an older phone without recent security update from Android. The NDI receiver works perfectly fine. So I think the issue may related to the recent update for Android.

@keijiro could you check if this is related to the late update from Android? Thanks.

It works on my Pixel 5 with Android 13.

@keijiro Hi, I changed the Target API Level to Android 11.0(API Level 30), and it worked fine. It seems the API level neet to adjust below 31. I do not konw if there is any API restriction for the plugin.

Thank you very much for the valuable information, but hmm... I'm not sure why it solves the problem, either.

@keijiro,
I looked more into this issue and found out something may related to this outcome.

https://developer.android.com/about/versions/12/behavior-changes-12#mdnsresponder

"Android 12 changes when apps can interact with the mDNSResponder daemon using the [mDNSResponder native API]. Previously, when an app [registered a service on the network] and called the [getSystemService()]method, the system's NSD service started the mDNSResponder daemon, even if the app had not called any NsdManager methods yet. The daemon then subscribed the device to the all-nodes multicast groups, causing the system to wake more frequently and use additional power. To minimize battery usage, in Android 12 and higher the system now starts the mDNSResponder daemon only when it is needed for NSD events and stops it afterwards."

So I think the getSystemService in Android Helper cannot initialized mdnssd service due to this change. The workaround is to build below API 31 (that's what I did in the last reply). Is there any ways to modify the code to allow unity to call NsdManager directly to avoid this issue?

For anyone who has the same issue, one fix is to create an Android plugin and add a NSD Register Service to create a mddns section at beginning. I believe there are other ways, but this one works for me.

For anyone who has the same issue, one fix is to create an Android plugin and add a NSD Register Service to create a mddns section at beginning. I believe there are other ways, but this one works for me.

@tomsuperman
This sounds very promising, thank you for the investigation! I'm not sure what you mean by "create an Android plugin and add a NSD Register Service."

Can you share how you accomplish this? I have a feeling my app is failing to initialize the mddns service.

Building Android 32 from Unity, by the way. Target platform is Quest 2. My builds that target Android 30 work fine.