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 ) );
m_pMediaPlayer->setVolume(100);
m_pMediaPlayer->play();
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?
Regards,
Daníel
[edit: code wrapping added, koahnig]
↧