PDA

View Full Version : Program crashing when trying to play video



Lokplart
3rd August 2020, 17:47
Hi. My program is crashing when I try to play a video on it.


videoPlayer = new QMediaPlayer();
videoItem = new QGraphicsVideoItem();
videoItem->setSize(QSize(gameWidth + 4, gameHeight + 4));
videoItem->setAspectRatioMode(Qt::KeepAspectRatioByExpanding) ;
videoPlayer->setVideoOutput(videoItem);
videoPlayer->setMuted(true);
videoPlayer->setNotifyInterval(500);
scene->addItem(videoItem);

Then then I have a function that I call when I show a video:


if (videoPlayer->state() != QMediaPlayer::PlayingState) {
QFileInfo media_info(gameDirectory + video_url);
if (media_info.isFile()) {
video_url = "";
videoItem->show();
videoPlayer->setMedia(QUrl::fromLocalFile(media_info.absoluteFi lePath()));
videoPlayer->play();
}
}

The error I get is this:
ASSERT: "m_surface" in file player\mfvideorenderercontrol.cpp

Call stack:


> Qt5Cored.dll!666a4ab1() Unknown
Qt5Cored.dll![Frames below may be incorrect and/or missing, no symbols loaded for Qt5Cored.dll] Unknown
[External Code]
wmfengined.dll!MFVideoRendererControl::createActiv ate() Line 2346 C++
wmfengined.dll!MFPlayerSession::addOutputNode(IMFS treamDescriptor * streamDesc, MFPlayerSession::MediaType & mediaType, IMFTopology * topology, unsigned long sinkID) Line 406 C++
wmfengined.dll!MFPlayerSession::setupPlaybackTopol ogy(IMFMediaSource * source, IMFPresentationDescriptor * sourcePD) Line 308 C++
wmfengined.dll!MFPlayerSession::handleMediaSourceR eady() Line 266 C++
wmfengined.dll!MFPlayerSession::qt_static_metacall (QObject * _o, QMetaObject::Call _c, int _id, void * * _a) Line 148 C++
[External Code]
qwindowsd.dll!QWindowsGuiEventDispatcher::sendPost edEvents() Line 81 C++
[External Code]

If I ignore the error, the video plays just fine which is really confusing.
Can someone please explain to me where I'm going wrong?