PDA

View Full Version : QVideoWidget\QMediaPlayer doesn't show up and locks everything within application



mapcol
15th July 2016, 16:08
I have bit of a complicated qt structure; some parts are made with designer, some part are made with code. Yet this is not very important.
The point is:
I have my main window, which contains different things, one of which is a widget (called centralWidget), which contains layouts and other widgets.
Everything works fine till a simply add:

QVideoWidget* videoWidget = new QVideoWidget(ui.centralWidget); // I can put nothing, or "this" inside the constructor...nothing changes
QMediaPlayer player;

TV_V_LAYOUT_MAIN_1->addWidget(videoWidget);
player.setVideoOutput(videoWidget);

This lines of code are inside a function which builds buttons inside the layout, and this function gets called inside the mainwindow constructor.

As soon as I add this videowidget with videoplayer, everything within my application gets locked (buttons, scrollbars, comboboxes... some are in other layouts).
Sometimes they are locked, sometimes they are really really slowed down. It's like those elements are either completely locking or dramatically slowing down the application.

I saw another person asked this question in this forum a few years ago, yet nobody answered.



This is very important to me, because its for my BA project for a very important company and I'm stuck with this problem since last month

You can also see my question on stackoverflow http://stackoverflow.com/questions/37986857/qt-qvideowidget-doesnt-show-up-and-disables-all-buttons-within-application-or

I'm using Visual Studio 2013 + Qt5 Add-In + gstreamer.

Can anybody plase give me a hint? I don't know what to do anymore...

anda_skoa
16th July 2016, 11:36
Have you tried not settnig minimum/maximum sizes and letting the layout handle that?

Does the video widget work when it is the only widget?

Cheers,
_

mapcol
18th July 2016, 13:09
As you can see in the example in this thread here, I'm not setting any minimum / maximum size.
I deleted the QMediaPlayer and let only the QVideoWidget and the buttons and everything else is working. Yet nothing is appearing in the application.

I don't know how to state whether or not the QVideoWidget was correctly initialized and positioned.

I did this:

Without initializing the videowidget the application looks like this: 12036

By initializing the videowidget with the lines below:

QVideoWidget* videoWidget = new QVideoWidget;
videoWidget->setStyleSheet("background-color: #1f1f1f;");
TV_V_LAYOUT_MAIN_1->addWidget(videoWidget);

The result is:
12037


As you can see the qlabel "Incoming streaming" moved left (it's in the same layout as the one in which the videowidget is inserted). So I guess it was correctly inserted.
Any other advice??

Thank you,

marko

anda_skoa
18th July 2016, 13:35
Have you tried the video widget on its own as I suggested in my previous comment?
If that works, then maybe as a child of a plain QWidget with a box layout and a single button.

Cheers,
_

mapcol
18th July 2016, 14:36
okey i made a new project and tried the tutorial for qt5: http://doc.qt.io/qt-5/qtmultimedia-multimediawidgets-videowidget-example.html

The player works fine, when I try to open a media (mp4 or mkv) file I get the following error:
DirectShowPlayerService::doRender: Unresolved error code 0x80040266 (IDispatch error #102)

mapcol
18th July 2016, 16:48
Okey I installed the necessary codecs pack and the tutorial's example works!


I am able to play videos on my application with videowidget and mediaplayer

Yet the buttons, comboboxes, tabs ecc are still extremely slowed down. It's like those qt elements extremely block my application
Like clicking on the play/pause button, it does his job, but the button does not show the animation...

mapcol
20th July 2016, 14:33
Solved it by moving all qt5 dll's into my project folder.

Yet, I need to connect gstreamer sink's to Qt5 VideoWidgets

My question is here: http://stackoverflow.com/questions/38465223/what-is-the-correct-way-to-link-qt5-videoplayers-to-gstreamer-sinks