-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[Safari] The audio is broken on certain MacOS/Safari versions #4411
Comments
I've encountered an additional behavior while testing. If for example a YouTube video is playing in a different tab, when focusing the Hubs tab the video's audio from the Youtube tab is broken. |
|
On my MacBook Pro, macOS Big Sur 11.4, Safari Version 14.1.1, I can reproduce the audio issue. But I can't reproduce the performance issue. According to the console logs you shared, the shader compile fails and I speculate it's the cause. But I don't see shader compile error on my end. Could it be scene or object specific issue? Cab you create a scene and pin objects where you encounter the compile error and the performance issue? |
I'd suggest we open a new issue for the performance problem. |
I've reproduced the audio distortion issue consistently in Safari 14.1.1 on macOS (11.4 MacBook Air M1 2020) and iOS (14.6 iPhone 11). The issue reproduces at different rates in different environments, but it does happen eventually in all cases. The issue does not occur on Chrome or Firefox on macOS. |
Nice investigation!
I agree with it. Disabling spatial audio should be much better than broken audio. Regarding the performance issue, I confirmed that CPU usage on Mac is very high even on a simple Three.js positional audio example so I speculate the performance problem may be very relevant to the audio issue as @Softvision-RemusDranca mentioned. @brianpeiris Did you already start to work on the workaround? If not and you don't have time, I can take it. I hope we add the workaround soon and test to check if the performance issue can also be resolved. |
#4442 Fixes avatar audio issues for the next Hubs Cloud release, but I'll have to deal with the current version of the code separately for HMC, since the new audio code is quite different. |
I would like to try to apply the same change to |
Go ahead @takahirox I'm going to continue focusing on Hubs Cloud. |
OK, made a PR #4503 |
Thanks to #4594, the distorted audio on MacOS Safari seems to be resolved by sacrificing PositionalAudio. The iOS Safari one seems much better than before, but I realized it stills has some audio distortion issues. After being a room for like 5-10mins, the audios are distorted and broken. How to reproduce.
@Softvision-RemusDranca reported the same problem. Also, I can reproduce the problem with just a video. I spawned a video on iOS Safari, move around for like 5-10 mins, and then the audio started to be distorted and broken. I couldn't reproduce the problem on MacOS Safari so far. When the problem happens, my iPhone is very hot. I have a impression that the problem happens when CPU is busy (or it can be Audio buffer problem). So potentially the problem could be related to #4423. |
Regarding the Positional (Panner) audio bug fixed in #4594, we thought it was a Safari specific bug but it seems that I can reproduce the problem even on iOS Chrome/Firefox. (I speculate iOS Safari/Chrome/Firefox use the same core webkit library?) Currently we disable Positional audio for Safari but we may need to disable it for Safari or iOS. Can anyone here check if you can reproduce the problem on iOS Chrome/Firefox on your end, too? |
@takahirox If we can't diagnose and fix the root cause, I wonder if there's a workaround we can do where we disconnect from dialog, tear down all the voice connections, and then reconnect/recreate them every 5 minutes or so. |
@johnshaughnessy It might be worth to try, although I'm not really sure if it can resolve the problem. (And I'm really not sure yet if we have a workaround) |
I made a simple test case. https://takahirox.github.io/ios-webaudio-test/ It plays music with or without WebAudio. On my iOS 14.8, the audio with WebAudio is broken after about two minutes regardless of browsers (Safari/Chrome/Firefox) while the one without WebAudio isn't broken. I'm going to report this problem to webkit bugzilla. (I guess all the major iOS browsers use the same webkit engine for WebAudio.) WebAudio on iOS doesn't seem to be stable. I googled and found that WebAudio on iOS has repeatedly had bugs, fixed them, and had regression bugs again. I'm thinking of avoiding to use WebAudio until iOS WebAudio will be matured enough. A workaround in my mind is to add a new (Three.js) audio class which plays audio just with |
TLDR: I would like to suggest to force to disable MacOS BigSur 11.6 and iOS 15 have been released and I tested some audio on them. I first thought we had a single root issue causing the broken audio problem even without panner node, but It seems we had two (or more) audio issues in iOS 14. One of them seems to have been resolved in iOS 15. But another one seems to still exist.
This is the problem which seems to have been resolved in iOS 15. WebAudio
With fixed The root issue seems (Finally!) I made a simple test case reproducing the crackle noise problem on iOS https://takahirox.github.io/ios-webaudio-test/video_user_media.html If you click "run" button on your iOS, you would hear crackled audio from the video. A workaround seems to be disabling I also tried to disable So, I would like to suggest to force to disable
While doing the You can test it in the test by unchecking "Use getUserMedia() for mic". I haven't come up with a solution yet. We might be able to try other
I also checked if we still need disabling panner node workaround for Safari. It seems yes, we still need it. I tested panner node on Safari. But the audio is broken after being in a room after some minutes. It sounds even worse then before. The audio problem can be reproducible even in the Three.js audio orientation example. |
I discussed the crackle audio noise problem and we found that it might be old iPhone specific problem. We don't have many enough iOS devices, so iOS users, can I ask for volunteers? I'm happy if you run the test to check whether you can reproduce the problem I encountered, and report to me here whether you can reproduce or not.
|
@takahirox I have the same result as @jure , no crackling noise with or without echoCancellation. I used Iphone SE2 with Safari 15. |
Thanks all. I also asked for the test at different places and we have tested five iPhone devices in total. The models on which the audio noise problem is reproducible
The models on which the audio noise problem isn't reproducible
Sounds like the problem is reproducible only on old (2017 or before?) models (maybe meaning less powerful models). We couldn't find global iPhone model market share numbers, but I guess iPhone users generally use newer models? So I don't think we should force to disable echo cancellation. (#4679) We can share the tips with users instead
|
Sounds like the broken audio issue shouldn't happen in iPhone SE 2 + iOS 15 and with the patches we recently applied. Do you mind if testing again to check if the problem is still reproducible? |
No crackling with echoCancellation on or off with iPad 2018 6th gen iOS 14.8. |
@takahirox Unfortunately, I was able to reproduce the issue using Iphone SE2 after approximately ten minutes but it was only for a very short moment, after that the audio was working again. The issue reproduced while I was playing a video in the background and also having a conversation between two users. |
Thanks for testing. The problem doesn't seem to be occurred on iPad. It's good to know that at least it sounds better than before. But you couldn't reproduce the audio noise problem on https://takahirox.github.io/ios-webaudio-test/video_user_media.html but can still reproduce the noise problem on Hubs. Hm, there might be another issue or high resource usage may affect the audio quality. I think it's hard to further investigate. I will report the problem to Apple devs so far. |
Reported to https://bugs.webkit.org/show_bug.cgi?id=227199 Please post there if you have additional context. |
Just to add more data points, I tested this today with my iPhone 11, running iOS 15.4 and Safari 15.4. I used two bots with movement and audio, and ran the test for 30 minutes. Audio did not distort or crackle. I guess this is primarily due to #4594. The Safari team may have also fixed some underlying issues, but we'd have to test with positional audio re-enabled to verify that. I'd suggest we can close this bug, since it is not an issue for current models and the latest iOS/Safari. If it is still an issue on older iPhone models, and we care about fixing that issue, we can open a new ticket with up-to-date, summarized information about the issue. |
hi i would like to check if positional audio is re-enabled? it looks like it's still disabled here https://github.com/mozilla/hubs/blob/fe4eb6ffbc94fb411f8d98754376aed7e0c2b01a/src/systems/sound-effects-system.js#L141 |
Thanks for the report. OK, just in case let's test again and if the problem is not reproducible we can re-enable it. |
Safari WebAudio Panner node seemed to have a problem that the audio can be broken. We decided to force to disable panning audio on Safari. See #4411 for details. The problem seems to have been resolved on Safari end. We can re-enable the panning audio even on Safari.
Made a PR #5460 |
Safari WebAudio Panner node seemed to have a problem that the audio can be broken. We decided to force to disable panning audio on Safari. See #4411 for details. The problem seems to have been resolved on Safari end. We can re-enable the panning audio even on Safari.
[Notes]:
[Affected Versions]:
[Affected Platforms]:
[Prerequisites]:
[Steps to reproduce]:
[Expected results]:
[Actual results]:
[Additional Notes]:
┆Issue is synchronized with this Jira Task
The text was updated successfully, but these errors were encountered: