mpv-examples
mpv-examples copied to clipboard
How to play video with libMpv in the same window with MainWidget according to the example qt-opengl?
In the example of qt_opengl, I move the code of set command of 'load file' into the constructor function of MainWidget, and want to play video automatically. But there are two windows as shownd in the picture below(the picture of first comment) when launching the app.
How can I set options or properties of libmpv to play video in the same window with MainWidget?
thx.
My program has only one in windows,has two windows in linux.
I want to know how to solve it on linux?
mpv.cpp
MpvWidget *widget = (MpvWidget *)this->parent(); int64_t wid = widget->winId(); mpv_set_option(mpvPlayer, "wid", MPV_FORMAT_INT64, &wid);
widget.cpp
ui->setupUi(this); QString qexeFullPath = QCoreApplication::applicationDirPath()+"/1.mp4"; ui->playWidget->setUrl(qexeFullPath); ui->playWidget->open();
I think you should call mainwindow->show() before load video file