-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
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
Not work audio streaming on android 11 #3796
Comments
Dis you follow the instructions specific to Android 11? https://github.com/Genymobile/scrcpy/blob/master/doc/audio.md |
Yep. The screen is on, the developer settings do not block access to the sound. I also tried it with the |
For testing, could you please replace the server in the scrcpy 2.0 release folder:
It disables the workaround for Android 11: diffdiff --git a/server/src/main/java/com/genymobile/scrcpy/AudioCapture.java b/server/src/main/java/com/genymobile/scrcpy/AudioCapture.java
index 9228e3d71..6d336ac66 100644
--- a/server/src/main/java/com/genymobile/scrcpy/AudioCapture.java
+++ b/server/src/main/java/com/genymobile/scrcpy/AudioCapture.java
@@ -85,7 +85,7 @@ public final class AudioCapture {
}
public void start() throws AudioCaptureForegroundException {
- startWorkaroundAndroid11();
+ //startWorkaroundAndroid11();
try {
recorder = createAudioRecord();
recorder.startRecording();
@@ -97,7 +97,7 @@ public final class AudioCapture {
}
throw e;
} finally {
- stopWorkaroundAndroid11();
+ //stopWorkaroundAndroid11();
}
}
Then, unlock your device, and execute:
It should open a popup. Keep it open and visible (your device must be kept unlocked and powered on). Then run |
Yes. It works. Even if you press OK at the popup, the sound keeps streaming. And it only works the way you said it would. This is the window that pops up (sorry for the Russian lang in system) |
OK, so the culprit is probably the delay here:
Are you comfortable to build the app from sources? You could try to adjust the delay until you get a value which works for your device. I'm interested in that value :) |
It doesn't look hard, I'm going to try it now |
I would like to clarify. Which way should I change the delay? Higher or lower? |
It seems the delay is insufficient in your case, so you must use an higher delay. |
After 5 hours of misunderstandings with Linux I finally installed it. Delay of 300 (units, seconds, whatever) is working |
Thank you. Does it 100% work with 300ms? I will probably increase the current value to 300 then. |
It worked at 200 every other time, I have not tested at 250. I can check later. But at 300 it definitely works. |
Hi I have an issue that seems related. For some reason audio works fine for me on Windows, but fails on Linux, with the same error:
I haven't tried changing that delay yet, but it seems a bit weird that the Linux version would require a different delay than the Windows version. |
Could you please try? ❤️ |
Alright, with a delay of 250 it seems to work fine every time. I haven't tried any other values, though, but I might later. EDIT: After a bunch of restarts I did manage to get it to fail. 300 might be better then. |
I implemented 3 attempts with 100ms before each, so that on most devices, it will work within 100ms (so the popup is not visible for too long), but on others it will still work: bc82e34 Here is a full build for win64:
Please tell me if it works for you. |
Yep. Working on my phone. Thanks. I think we'll wait for feedback from other users, and close this issue |
scrcpy/server/src/main/java/com/genymobile/scrcpy/AudioCapture.java Lines 61 to 79 in 2ef1430
It checked |
Yes, I noticed that yesterday 👍 It will be fixed by aa6846c (not merged yet). |
I just saw all these branches. What a horror) |
🙈 |
Locally: $ git branch | wc -l
1062 I should probably do some cleanup. 😄 However, I want to keep many of them somewhere, to be able to (manually) "bisect" across branches for debugging. For example, if a bug is reported, and I observe that it works on git range-diff audio.107~102..audio.107 audio.145~119..audio.145 |
Environment
Describe the bug
The sound just doesn't work. When you try to make it forcibly this happens
The text was updated successfully, but these errors were encountered: