Qt World Summit: Register Today!

MP3 AutoPlay & Looping with QML

  • How to autoplay & looping an audio (mp3) file with QML?
    I've tried using Audio component from QtMultimediaKit but it didn't do the job :(
    the autoLoad property that should automatically play the audio didn't affect at all..
    the other problem goes when I use mp3 file. The file didn't played in full duration but it's fine with wav file


  • What target are you using? Can you give more information on the QML ?

    I think that maybe a problem of loading completion when the application start but it is only an intuition...

  • I'm developing for N9. I follow the example on the documentation and set the value of 'autoLoad' property to 'true' and expecting the audio will start automatically.

  • Please post more information about the code, where is the example, something that can help us to understand what maybe the problem, thank you.

  • here is my code..

    import QtQuick 1.1
    import com.meego 1.0
    import QtMultimediaKit 1.1

    Page {
    id: mainPage

    Audio {
        id: music
        source: "soundtrackFast.mp3"
        autoLoad: true
    orientationLock: PageOrientation.LockPortrait


    and here is the documentation: http://doc.qt.nokia.com/qtmobility-1.2/qml-audio.html

  • I think that it is not so simple to manage it. Regarding autoload property, it maybe a bug because reading the documentation there is not more to do. Just try to remove the setting because the autoLoad is set to tru by default. Sometimes I ecperienced that setting a default value again the result was not what I expected.

    Then the problem that the media in the MP3 case is not played for full, I think that maybe a buffering problem and/or that there are some differences respect the wav format to know the duration i.e. the file lenght. Let me a while and I will search about this. I have found something about the tricks to manage the mp3 files correctly but in this moment I can't see where.

Log in to reply