QML video gives Error: "No valid frames decoded before end of stream" some of the time
Unsolved
QML and Qt Quick
-
Hello, I'm trying to get a QML media player + video output working. The media is played about nine out of ten times. But sometimes the media isn't loaded at all, and I have no reason why.
Application output shows - Error: "No valid frames decoded before end of stream" - when the media isn't loaded. It seems like this might be a bug in GStreamer, but I haven't found much about how to work around it using QT.
Here's my QML file
import QtMultimedia 5.8 import QtQuick 2.12 import QtQuick.Window 2.12 Item { height: Screen.height width: Screen.width MediaPlayer { autoLoad: true autoPlay: false id: player } VideoOutput { anchors.fill: parent id: videoOutput source: player } }
And here is the code that is loading the media / telling the media player to play (I didn't include all the code, and its hobbled together from different files):
// connections connect(stackedViews->getMediaPlayer(), SIGNAL(stateChanged(QMediaPlayer::State)), this, SLOT(animationStateChanged(QMediaPlayer::State))); connect(stackedViews->getMediaPlayer(), SIGNAL(mediaStatusChanged(QMediaPlayer::MediaStatus)), this, SLOT(mediaStatusChanged(QMediaPlayer::MediaStatus))); // slots void BootDisplay::animationStateChanged(QMediaPlayer::State state) { if (state == QMediaPlayer::StoppedState) { qDebug() << "Boot animation finished!"; } } void BootDisplay::mediaStatusChanged(QMediaPlayer::MediaStatus status) { if (status == QMediaPlayer::MediaStatus::LoadedMedia) { qDebug() << "Media loaded into player"; stackedViews->getMediaPlayer()->play(); } } // getMediaPlayer function QMediaPlayer* StackedViews::getMediaPlayer() { QMediaPlayer* obj = videoView->rootObject()->children()[0]->findChild<QMediaPlayer*>(); if(obj) { return obj; } else { qDebug() << "Can't find the MediaPlayer!!!"; return nullptr; } }
-
Any luck on solving this problem?