How to close video widget window once video is done playing QVideoWidget?

154 views Asked by At

I want to display a video when a button is clicked and close the video widget once the video is done playing in QT 6.4, and if there is no workaround that, if I could somehow display the video in a widget I create on QTDesigner that would work well too, thank you!

QMediaPlayer* player = new QMediaPlayer;
player->setSource(QUrl("C:/Users/QTDev/Desktop/final.mp4"));

QAudioOutput * audioOutput = new QAudioOutput;

player->setAudioOutput(audioOutput);
audioOutput->setVolume(1.0);

QVideoWidget* videoWidget = new QVideoWidget;
player->setVideoOutput(videoWidget);

videoWidget->showFullScreen();
player->play();
0

There are 0 answers