Audio not playing on safari mobile (17.6.1)
Is there an existing issue for this?
- [X] I have searched the existing issues
Current Behavior
When clicking play on the tab, no audio is being played. The tab "works" (e.g. scrolling works) but no audio is being played.
Expected Behavior
Audio should play
Steps To Reproduce
- go to alpha tab. and play the file. No audio is being triggered
Link to jsFiddle, CodePen, Project
No response
Found in Version
1.3
Platform
Web
Environment
- **OS**: iOS 17.6.1
- **Browser**: safari
- **.net Version**:
Anything else?
Interestingly, if I open a new tab and play a YouTube video while the tab is being played, the audio is now being reproduced. I can then stop and pause or refresh the page and audio will still work. When closing safari and opening it again it stops playing.
https://github.com/user-attachments/assets/283e45bf-a016-4874-92e9-1ea4023ec886
Unfortunately I don't have a device with your exact version available but for me its working fine using Browserstack with iPhone 15 iOS v17.5. Unfortunately on iPhone 16 iOS v18 i cannot hear any audio on browserstack (for any website and both chrome and safari) so its hard to reproduce.
It sounds to me like a system level problem of audio being blocked. Can you check if following websites are generating a sound for you. This would at least tell us if it is a general browser/OS problem or something that alphaTab does wrong.
- https://googlechromelabs.github.io/web-audio-samples/audio-worklet/basic/hello-audio-worklet/
- https://webaudioapi.com/samples/script-processor/
Ping @dovidio Any feedback on the points above?
Hey sorry for the late reply @Danielku15 , I've just tried it now and I could replicate the same issue for both links you posted
In this case the problem seems to be rather browser/system-wide and not a problem in alphaTab. Without real device to test it is hard to do any fiddling what might activate the system to play the audio.
Do you have multiple devices where this problem happens? Maybe you could ask around on StackOverflow or in an Apple Developer/User Forum (referring to the links above). If there is something alphaTab could do to wake iOS up I'm happy to add it.
@dovidio I got hold of an iPad with iPadOS 17.6.1 installed and I did not face any issues with Safari. alphaTab and all sample links above work fine for me. In your case it seems to be an iPhone (from the screen size).
With all the reading I've done it seems to be rather a WebKit/Safari/iOS problem. If you have any findings how the problem can be solved from our side feel free to repoen this issue. Until then my conclusion is:
It seems WebKit/Safari as some OS level problems to activate the audio correctly.
- I've read about cases where the audio was simply not played through the loud speaker but the phone Zall speaker and it's easy to not hear it.
- People tried with workarounds to play some other audio things on the page (e.g. rather via an
<audio />tag play some small sample to activate the speakers)
@Danielku15 Thank you for the investigation. We can conclude it's a os level issue since:
- it works fine with iPad and Mac
- it doesn't works on iPhone using Chrome or Safari
I've sent detailed feedback to Apple, plus I've opened a thread on the apple developer forum. Nothing to do on alphaTab side for now, I'll keep you posted if I find some workaround 👍
I believe this is a non-issue. The behavior I have experienced is that AudioWorklets respect the system ringer setting. If the ringer is off, volume output is disabled, if the ringer is on, volumen output is enabled.
- **OS**: iOS 18.2.1
- **Browser**: safari
https://github.com/user-attachments/assets/fde13b8a-3f9a-488c-ac68-8d24890e343b