The PlaySound manual page says “PlaySound auto plays”. It appears that PlaySound queues the sound until the user manually interacts with the app. If PlaySound is included in a buttonClick event then the sound plays. If, instead, PlaySound is included in the Form.OnShow() event or if it is located in a Function that is invoked with a SetInterval timer then the sound is queued until the user interacts with the app. This appears to require that the action be associated with an event handler. For example, clicking on the form without a Form.OnClick() event handler leaves the sound in the queue.
I’m not sure how one could play a sound upon launch of the app for example. Maybe by putting an event invocation directly in the onShow() event prior to invoking PlaySound??
The whole point of this new restriction is to prevent apps from auto playing sounds as soon as they are loaded. It was being abused by sites: can you image how annoying it would be to have a site say “Buy my stuff now!!!” as soon as you load it?
@ghenne is right, the restrictions are to prevent apps from annoying people.
The work around, after you’ve onboarded and established your push notification tokens, request a push notification from the server that plays the sound.
If your server and app are fast enough you may get the sound during the splash screen, otherwise it will come on the home screen. It’s risky but it can be done.
@ghenne (feel free to delete this as you wish).
Unless I missed something, your app is a web app, which has the autoplay restriction. If you “compiled” it into an app that can be downloaded from one or more of the “stores” and installed on target devices, then the restriction doesn’t exist, as the user has opted in to the app, so to speak.