alphaTab icon indicating copy to clipboard operation
alphaTab copied to clipboard

Audio not playing on safari mobile (17.6.1)

Open dovidio opened this issue 1 year ago • 4 comments

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

  1. 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

dovidio avatar Sep 19 '24 11:09 dovidio

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/

Danielku15 avatar Sep 21 '24 10:09 Danielku15

Ping @dovidio Any feedback on the points above?

Danielku15 avatar Oct 12 '24 15:10 Danielku15

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

dovidio avatar Oct 12 '24 16:10 dovidio

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.

Danielku15 avatar Oct 12 '24 16:10 Danielku15

@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 avatar Nov 03 '24 12:11 Danielku15

@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 👍

dovidio avatar Nov 10 '24 08:11 dovidio

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

ajchili avatar Feb 07 '25 00:02 ajchili