Qt for WebAssembly can play audio from url
-
Hello,
I use Qt 6.8.0, with qml I use Multimedia to play audioMediaPlayer {
autoPlay: true
loops: MediaPlayer.Infinite
source: "*.mp3" // url from internet
audioOutput: AudioOutput {
volume: moduleController.infoController.musicVolume / 100
}
}It works perfect on desktop but not in WebAssembly
So are there any ways to play audio on WebAssembly or I must wait for incoming versions of Qt (Current 6.8.0 is latest) -
AutoPlay and loops do not work in Qt 6.8.0/6.8.1. In 6.7.2, autoPlay is normal but there can only be one visible videooutput. Loops does not work either. In addition, your wasm must set the source externally, such as after clicking a button or "Component.onCompleted" . mediaPlayer.source = "xxx.mp3" Also, even if you only play audio, it seems that you need to set videoOutput, and since 6.7.3, there may be memory problems when using loader and mediaplayer. So it's better to avoid using mediaplayer.