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);
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);
To copy to clipboard, switch view to plain text mode
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.
absoluteFilePath()));
videoPlayer->play();
}
}
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.absoluteFilePath()));
videoPlayer->play();
}
}
To copy to clipboard, switch view to plain text mode
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::createActivate() Line 2346 C++
wmfengined.dll!MFPlayerSession::addOutputNode(IMFStreamDescriptor * streamDesc, MFPlayerSession::MediaType & mediaType, IMFTopology * topology, unsigned long sinkID) Line 406 C++
wmfengined.dll!MFPlayerSession::setupPlaybackTopology(IMFMediaSource * source, IMFPresentationDescriptor * sourcePD) Line 308 C++
wmfengined.dll!MFPlayerSession::handleMediaSourceReady() 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::sendPostedEvents() Line 81 C++
[External Code]
> 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::createActivate() Line 2346 C++
wmfengined.dll!MFPlayerSession::addOutputNode(IMFStreamDescriptor * streamDesc, MFPlayerSession::MediaType & mediaType, IMFTopology * topology, unsigned long sinkID) Line 406 C++
wmfengined.dll!MFPlayerSession::setupPlaybackTopology(IMFMediaSource * source, IMFPresentationDescriptor * sourcePD) Line 308 C++
wmfengined.dll!MFPlayerSession::handleMediaSourceReady() 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::sendPostedEvents() Line 81 C++
[External Code]
To copy to clipboard, switch view to plain text mode
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?
Bookmarks