Add mp4 video
-
Hello, I want to ask you something. I made a video design. I want to play this video on the interface screen I created in Qt widget Applications. But I want to do it without using keys like play, pause. As soon as I run the interface, I want the video to appear directly on the screen. How can ı do that?
-
Hi,
You can use a QVideoWidget and start the video from your code.
-
Hi,
You can use a QVideoWidget and start the video from your code.
@SGaist said in Add mp4 video:
Hi,
You can use a QVideoWidget and start the video from your code.
I looked at the page you said and did it, but the video did not appear on the screen. The blank main window just popped up. Why did this happen?
-
@SGaist said in Add mp4 video:
Hi,
You can use a QVideoWidget and start the video from your code.
I looked at the page you said and did it, but the video did not appear on the screen. The blank main window just popped up. Why did this happen?
-
@jsulm said in Add mp4 video:
@Rumeysa_135 said in Add mp4 video:
Why did this happen?
Hard to say without seeing your code...
MainWindow::MainWindow(QWidget parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
QMediaPlayer player = new QMediaPlayer;
QUrl videoUrl = QUrl::fromLocalFile("C:/Users/Desktop/video.mp4");
QMediaContent videoMedia(videoUrl);
player->setMedia(videoMedia);
QVideoWidget* videoWidget = new QVideoWidget;
videoWidget->setMinimumWidth(640);
videoWidget->setMinimumHeight(360);
player->setVideoOutput(videoWidget);
videoWidget->setGeometry(QRect(10, 10, 640, 360));
player->play();}
-
@jsulm said in Add mp4 video:
@Rumeysa_135 said in Add mp4 video:
Why did this happen?
Hard to say without seeing your code...
MainWindow::MainWindow(QWidget parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);
QMediaPlayer player = new QMediaPlayer;
QUrl videoUrl = QUrl::fromLocalFile("C:/Users/Desktop/video.mp4");
QMediaContent videoMedia(videoUrl);
player->setMedia(videoMedia);
QVideoWidget* videoWidget = new QVideoWidget;
videoWidget->setMinimumWidth(640);
videoWidget->setMinimumHeight(360);
player->setVideoOutput(videoWidget);
videoWidget->setGeometry(QRect(10, 10, 640, 360));
player->play();}
@Rumeysa_135 As far as I can see you're neither showing videoWidget nor putting it into a layout, so it is not shown. And as soon as you call show on it it will be shown as stand alone widget because it does not have a parent and is not added to any layout.
-
DirectShowPlayerService::doRender: Unresolved error code 0x80040266 () How can i fix this error?
-
DirectShowPlayerService::doRender: Unresolved error code 0x80040266 () How can i fix this error?
First thing, did you address the issues pointed in your code ?
Next, can you properly render that file on your system ?
Then, which version of Qt are you using ?
The latest 6.5 should use the ffmpeg backend.