View Full Version : Not able to play ogg files on Mac using QMediaPlayer.

19th May 2016, 13:24
I want to play ogg file on mac using Qt 5.6. Below is the application code I wrote to test.

#include "mainwindow.h"

Widget::Widget(QWidget *parent)
: QWidget(parent)
m_player = new QMediaPlayer(this);
connect(m_player, SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatu s)), this, SLOT(onMediaStatusChanged()));
connect(m_player, SIGNAL(positionChanged(qint64)), this, SLOT(onProgressed(qint64)));



void Widget::onProgressed(qint64 pos)
qDebug()<<"Position is:"<<pos;

void Widget::onMediaStatusChanged()
qDebug()<<"Media Status Changed:" << m_player->mediaStatus() << " " << m_player->error();

Here is the output I am getting.

Position is: 0
Media Status Changed: QMediaPlayer::LoadingMedia QMediaPlayer::NoError
Media Status Changed: QMediaPlayer::InvalidMedia QMediaPlayer::FormatError

Same code is working fine on windows (except the file path of course) for all formats(wav, aiff).
Other formats are being played on mac also. Problem is only with the ogg format. Can somebody help me with that?