Open dduynam opened 3 weeks ago
Do you have some headphones connected?
You mean headphones connected to my PC or the device running Android. Actually, my PC is connecting to one headphone device. and the Android device does not.
Updated: I tried to disconnect and retry to scrcpy. But it still doesn't work.
Weird, which device is it?
Does it work with another device?
It's an Android-based embedded project. Is there any abnormal point captured on log? If it's fine, then I suspect there is a security mechanism on that device to limit the audio forwarding.
I suspect there is a security mechanism on that device to limit the audio forwarding.
Or something not implemented related to REMOTE_SUBMIX capture.
Can you connect bluetooth earphones to this device? If so, is the audio correctly played in the earphones?
Does it work with another device?
Yes... I have tested it with my Android phone. The audio is output at PC normally.
Can you connect bluetooth earphones to this device? If so, is the audio correctly played in the earphones?
Actually, cannot connect BT earphones to this device. It doesn't support as an A2dpSource Audio gateway.
FYI, I just used your sndcpy (https://github.com/rom1v/sndcpy) and it works, but the audio latency was very high (around 1-2s). As followed the info from your old issues, there's a big improvement in streaming audio delay in scrcpy as of v.2.1
@rom1v For the workaround of sndcpy, the audio is output at PC but high latency and cannot forward media sources (Radio, USB) except BT Audio and system sound. Is there different between sndcpy or scrcpy v.2? or basically sndcpy is embedded in scrcpy, using VLC for streaming audio.
Is there different between sndcpy or scrcpy
They are very different.
Sndcpy was just a proof-of-concept using the playback capture API introduced in Android 10. It installs a real app (an .apk) on the device (contrary to scrcpy which executes a Java main to get shell permissions, but cannot have a real Android Context necessary for some APIs).
One major drawback of this playback capture API is that it lets Android apps decide if they can be captured or not. In practice, many apps were just not captured.
For simplicity, the PoC just used VLC to play the stream, so there was absolutely no mechanism to regulate latency (so it's easy to get a lot of latency).
Scrcpy uses another mechanism to capture audio (which does not require an app, see #3757). And of course, there is a latency compensation mechanism (see an overview in this blog post).
Environment
Describe the bug I used scrcpy version of 2.4 to capture the screen and audio. But only the screen is shown but audio. Audio still is output at device. Please refer to the log print for more information. Thank you.