开发者

meego cannot play mp3 file

开发者 https://www.devze.com 2023-04-12 15:38 出处:网络
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.

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"
}
开发者_如何学Go

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消