We are experimenting problems with Audio component when playing sound on iPhone and iPad browser (iOs 14.xxx). We tried different format (mp3, wav, m4a) but no sound in iPhone/iPad browser. Everything run properly in all browsers on Windows. Please advice ?
Playing audio on iOS Safari requires user interaction from the client. You can’t use Wisej to initially play the audio because it’s part of a callback (the play gets blocked, see the console errors). Wisej uses polling or a WebSocket connection to receive changes from the server (and to process commands like the server-side audio.play() call). This comes in the form of a callback through the AJAX request or the WebSocket’s message processing.
You can however play audio through a callback after the client has interacted with the audio element or triggered play() through a client-side event.
So if your application requires users to login or click a button at all, you can add to the client-side JS “execute” event something like:
This satisfies the requirement of interacting with the element and dom (though no audio will be played here).
You can then go on later in your application and call audio1.Play() in your C# or VB code normally and it should play without an issue.
Please let me know if you have any issues with this!
As long as the Window or Page is created in Program.Main you’ll be able to access it using App.MainPage or App.Window1
If your audio and button are on the same level, you can use this so you don’t have to worry if it’s on a page or window:
Some helpful links:
You could accomplish auto-playing the audio through a custom WKWebView wrapper like the one provided as part of the Wisej Mobile package. It overrides a lot of the default Safari functionality to give developers more control over their application.
If you’re interested, you can contact sales AT wisej DOT com.
You can’t call Audio.Play() from the server on iOS. Safari doesn’t allow async calls to play the audio (https://developer.apple.com/forums/thread/94522). You can see it throws an error in the console (see attached image).
You can get around it by adding a ClientEvent for the “execute” event to a button with something like this:
It should work fine as long as you trigger audio.play() from the client and not through a callback.
If you need more help with this, please let me know and provide some more details on how you’re using it!
Please login first to submit.