I have an application built in Vue3 that plays a sound when a QR code is scanned. This feature works perfectly on Android and the web, but not when using the browser on iOS. I am struggling to identify the issue. Can anyone provide some insight?
<qrcode-stream
:camera="camera"
@decode="onDecode"
:torch="torch"
:track="drawoutline"
>
</qrcode-stream>
To trigger the function:
async function onDecode(data) {
new Audio(require("../assets/audio.mp3")).play();
}
If I manually trigger it with a button, the audio plays fine. However, it doesn't work automatically when the QR code is detected:
<q-btn
label="Play Sound"
@click="onDecode('Audio')"
></q-btn>
This explanation is simplified. The functionality functions well on Android and on the web, but when accessed through the web on iOS, the audio does not play unless the button is pressed. Can someone explain why this occurs?