I tried to implement SoundEffect from QtMobilityKit in QML to play music file in Meego Harmattan. I found that it can only play .wav file. is there any possible way to play .mp3 file in meego?

This one can play

SoundEffect{
    id: sound
    source : "/sound.wav"
}

and this one cannot

SoundEffect{
    id: sound
    source : "/sound.mp3"
}
有帮助吗?

解决方案

I haven't tested this, as my N9 hasn't arrived yet, but I think the following should work:

Audio {
    id: sound
    source: "/sound.mp3"
    // Start playback as soon as clip is loaded
    onStatusChanged: if (Audio.Loaded == status) play()
}

Note that you may see a slightly longer delay in starting playback of the MP3 compared with the WAV, as the encoded clip requires some more parts of the native multimedia framework to be initialized before it can be decoded and played.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top