• Regarding the QMediaPlayer type, what exactly is needed to get it to work? I'm using it to play an mp3 file, and currently it is not working. My code is basically as follows:
    m_pMediaPlayer = new QMediaPlayer( );
    m_pMediaPlayer->setMedia( QUrl::fromLocalFile( m_strNotificationSound ) );
    I've verified that m_strNotificationSound is a valid path and it points to a valid file (which I could previously play just fine using Phonon in Qt 4.8).

    Also, I have this code:
    QStringList types = m_pMediaPlayer->supportedMimeTypes();
    foreach( QString t, types )
    qDebug() << t;

    and it doesn't print out a single line. This is what I have in my .pro file:
    CONFIG += mobility
    MOBILITY = multimedia

    QT += core
    QT += qml
    QT += quick
    QT += declarative
    QT += xml
    QT += gui
    QT += widgets
    QT += multimedia
    Any ideas?


    [edit: code wrapping added, koahnig]

  • Moderators

    Please use "code wrapping":http://qt-project.org/wiki/ForumHelp#e3f82045ad0f480d3fb9e0ac2d58fb01
    This makes your code sections readable.

  • Thanks for the code wrapping hint, wasn't aware of it.

    I still haven't figured out why this didn't work, but since I am using QML in the same class, I switched to the Audio QML element, and that is able to play my file just fine. So this is at least partially solved.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.