Hello, I got a problem with VLC-Qt. This is my code writed in a constructor of a QMainWindow:
Code: Select all
VlcInstance* pInstance = new VlcInstance(VlcCommon::args(), this);
VlcMediaPlayer* pPlayer = new VlcMediaPlayer(pInstance);
VlcMedia* pMedia = new VlcMedia("E:/1.rm", true, pInstance);
VlcWidgetVideo* pWidget = new VlcWidgetVideo;
pPlayer->setVideoWidget(pWidget);
pWidget->setMediaPlayer(pPlayer);
pWidget->resize(320, 320);
pWidget->show();
pPlayer->open(pMedia);
With the code above, I can play the video. But if I change the "new VlcWidgetVideo" in line 4 to "new VlcWidgetVideo(this)", make the VlcWidgetVideo a child of the QMainWindow, then it shows only a black rectangle. I can still hear the sound though. How could I fix this? Any help would be greatly appreciated.