Hi everyone, I've been fighting with getting the Audio component to play sounds through a web browser for a few weeks now and am at a bit of an impasse. I have it setup to correspond to an alarm tag that when true will flip the playback value to true, and play the file until the alarm is no longer true.
I can get the sound to play when in the Ignition Designer without issue, however every time I try to get it to play in a browser window, nothing! I have verified the playback is set to true, volume of the element is at 100, and that computer speakers are on, but nothing still! Any suggestions or advice would be greatly appreciated!
This may be a permissions issue in your browser, you normally need to allow sound effects to play before the browser will let you.
Can maybe try with different browsers and check the browser settings
Have you tried looking in the web browsers console for any errors as well?
It seems to be working on Chrome now which is a starting point! Oddly in Edge (which runs on Chromium) still no dice, despite trusting the site and allowing everything, however there was no explicit Sound allowance field for it.
What's more is the Raspi I'm trying to run this on via Chromium browser is also unable to playback the sound! Maybe Chromium just hates ignition! ![]()
I'll try to get a copy of Chrome on it and report back!
Or maybe the sound file uses a patent-encumbered codec? Chrome has DRM and licenses to use such, Chromium does not.
I have been trying to use .wav files, I'm unaware if they are a patented codec, but I can always give some other formats a whirl if that is the issue
FYI, modern web browsers (including the view renderer used within Ignition Designer) have strict autoplay policies, which prevent websites from blasting audio or video without your prior interaction.
If your Perspective audio component does not appear to be playing audio, Clicking within the view may allow subsequent plays of the audio component to work, however of there has been a "play" attempt prior to interaction then the play property of the audio components won't reset itself, it will be stuck with play set True.
So it will be necessary to detect a stuck play property and perform a reset of it.
At this point I am not clear how to detect whether the browser interaction policy has been met, other than detecting when play fails to reset itself.
UPDATE: The detection options appear to be...
- When the
playproperty on the Perspective Audio component does not reset after a threshold duration. - By using the
onErrorevent of the Perspective Audio component, faster than waiting on a threshold duration. - Both require an attempt at playing something first.
Something malware would also want, so not likely to become reliable.