Unable to play audio from Qt
Unsolved
Mobile and Embedded
-
Hello I'm using Qt 5.9.6 on beagleboard-x15
I'm able to play audio using aplay <filepath.wav>
aplay -l list my available soundcard
While trying to play audio using Qt as provided on QMediaPlayer it is not playing
Qt can detect my soundcard using below methodforeach (const QAudioDeviceInfo &deviceInfo, QAudioDeviceInfo::availableDevices(QAudio::AudioOutput)) { qDebug() << "Device name: " << deviceInfo.deviceName() ; } qDebug() << "Default Output" << QAudioDeviceInfo::defaultOutputDevice().deviceName();
Where Default Output shows null
Here is my method how i'm trying to play audio file
tMediaPlayer = new QMediaPlayer(this); tMediaPlayer->setMedia(QUrl::fromLocalFile("file:/home/root/audio/instrument.wav")); connect(tMediaPlayer, SIGNAL(positionChanged(qint64)), this, SLOT(positionChanged(qint64))); tMediaPlayer->setVolume(90); tMediaPlayer->play();
Even tMediaPlayer->error() return NoError
-
Hi,
What if you remove the
file:
prefix ? There's no need for it,fromLocalFile
takes a normal path.