mpv-examples icon indicating copy to clipboard operation
mpv-examples copied to clipboard

How to play video with libMpv in the same window with MainWidget according to the example qt-opengl?

Open yarafa opened this issue 4 years ago • 3 comments

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.

yarafa avatar Jun 08 '20 08:06 yarafa

pic

yarafa avatar Jun 08 '20 08:06 yarafa

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();

li-yuelun avatar Jan 05 '21 08:01 li-yuelun

I think you should call mainwindow->show() before load video file

Hlongyu avatar Oct 27 '23 06:10 Hlongyu