Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Exit video full-screen
Forum Updated to NodeBB v4.3 + New Features

Exit video full-screen

Scheduled Pinned Locked Moved Solved General and Desktop
19 Posts 3 Posters 4.2k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mrjjM mrjj

    @HW-Developer
    Hi
    On some platforms ( Windows) the video is actual an overlay and not really inside the window.
    Im not sure if that is what you are seeing ?
    When you say detach from mainwindow, does it show as its own window or how does it look?
    Im asking as if you dont give a QWidget ( including QVideoWidget) a parent, it will become a window on its own.
    (if you show the code where u create the QVideoWidget, its easy to spot if that is the issue)
    Basically the difference is like
    QVideoWidget *vid= new QVideoWidget;
    versus
    QVideoWidget *vid= new QVideoWidget(this); <<< "this" is the parent

    H Offline
    H Offline
    HW-Developer
    wrote on last edited by
    #9

    @mrjj this is how it shows :
    0_1539619173308_Capture.PNG

    mrjjM 1 Reply Last reply
    0
    • H HW-Developer

      @mrjj this is how it shows :
      0_1539619173308_Capture.PNG

      mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #10

      @HW-Developer
      Super, i really think its just because your are not assigning a parent when you create it.
      it then becomes a window.
      So instead of replacing the other QVideoWidget you have, it just opens a (new) window.
      Thats easy fixed by assigning a parent.
      Did you based this off some sample i can look at ?

      H R 2 Replies Last reply
      1
      • mrjjM mrjj

        @HW-Developer
        Super, i really think its just because your are not assigning a parent when you create it.
        it then becomes a window.
        So instead of replacing the other QVideoWidget you have, it just opens a (new) window.
        Thats easy fixed by assigning a parent.
        Did you based this off some sample i can look at ?

        H Offline
        H Offline
        HW-Developer
        wrote on last edited by
        #11

        @mrjj I make you a simple example, it shows the same issue:

        #include "MyPlayer.h"
        
        MyPlayer::MyPlayer(QWidget *parent)
        	: QMainWindow(parent)
        {
        	ui.setupUi(this);
        	QWidget *zoneCentrale = new QWidget;
        	setCentralWidget(zoneCentrale);
        	player = new QMediaPlayer(this);
        	videoWidget = new MyVideoWidget(this);
        	videoWidget->setGeometry(100, 100, 500, 400);
        	fullScreen = new QPushButton("full-screen", this);
        	layout = new QVBoxLayout();
        	
        	
        	player->setMedia(QUrl::fromLocalFile("C:/Users/ouafa/Downloads/nature.mp4"));
        	player->setVideoOutput(videoWidget);
        	layout->addWidget(videoWidget);
        	layout->addWidget(fullScreen);
        	
        	zoneCentrale->setLayout(layout);
        	player->setVolume(100);
        	setCentralWidget(zoneCentrale);
        	
        	QObject::connect(fullScreen, SIGNAL(clicked()), this, SLOT(on_bt_agrandi_clicked()));
        
        	videoWidget->show();
        	player->play();
        	qDebug()<< player->isVideoAvailable();
        	qDebug() << player->availableMetaData() << player->currentMedia().canonicalUrl();
        }
        void MyPlayer::on_bt_agrandi_clicked() {
        	if (!videoWidget->isFullScreen()) {
        		videoWidget->setFullScreen(true);
        	}
        	
        	qDebug() << "hi there!";
        }
        
        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by mrjj
          #12

          Hi
          I could not reproduce
          alt text

          However, using you code 100% as is - made app crash. Not sure why.
          (just tried again to be sure)

          This is the code i used. i rearranged it a bit and gave zoneCentrale directly to the layout.
          else its pretty much the same. Can you try this ? ( change the mp4 file ofc)

           QWidget* zoneCentrale = new QWidget;
            setCentralWidget(zoneCentrale);
            auto player = new QMediaPlayer(this);
            auto videoWidget = new QVideoWidget(this);
            player->setVideoOutput(videoWidget);
          
            auto fullScreen = new QPushButton("full-screen", this);
            auto layout = new QVBoxLayout(zoneCentrale);
          
            player->setMedia(QUrl::fromLocalFile("F:/Dropbox/_qtprojects/wontdelete/test2.mp4"));
          
            layout->addWidget(videoWidget);
            layout->addWidget(fullScreen);
          
            player->setVolume(100);
          
            QObject::connect(fullScreen, SIGNAL(clicked()), this, SLOT(on_bt_agrandi_clicked()));
          
            videoWidget->show();
            player->play();
          
          H 2 Replies Last reply
          2
          • mrjjM mrjj

            Hi
            I could not reproduce
            alt text

            However, using you code 100% as is - made app crash. Not sure why.
            (just tried again to be sure)

            This is the code i used. i rearranged it a bit and gave zoneCentrale directly to the layout.
            else its pretty much the same. Can you try this ? ( change the mp4 file ofc)

             QWidget* zoneCentrale = new QWidget;
              setCentralWidget(zoneCentrale);
              auto player = new QMediaPlayer(this);
              auto videoWidget = new QVideoWidget(this);
              player->setVideoOutput(videoWidget);
            
              auto fullScreen = new QPushButton("full-screen", this);
              auto layout = new QVBoxLayout(zoneCentrale);
            
              player->setMedia(QUrl::fromLocalFile("F:/Dropbox/_qtprojects/wontdelete/test2.mp4"));
            
              layout->addWidget(videoWidget);
              layout->addWidget(fullScreen);
            
              player->setVolume(100);
            
              QObject::connect(fullScreen, SIGNAL(clicked()), this, SLOT(on_bt_agrandi_clicked()));
            
              videoWidget->show();
              player->play();
            
            H Offline
            H Offline
            HW-Developer
            wrote on last edited by
            #13

            @mrjj It's not working, when i make the changes, i run the app and click fullscreen button, it crash, and it blocks the app

            1 Reply Last reply
            0
            • mrjjM mrjj

              Hi
              I could not reproduce
              alt text

              However, using you code 100% as is - made app crash. Not sure why.
              (just tried again to be sure)

              This is the code i used. i rearranged it a bit and gave zoneCentrale directly to the layout.
              else its pretty much the same. Can you try this ? ( change the mp4 file ofc)

               QWidget* zoneCentrale = new QWidget;
                setCentralWidget(zoneCentrale);
                auto player = new QMediaPlayer(this);
                auto videoWidget = new QVideoWidget(this);
                player->setVideoOutput(videoWidget);
              
                auto fullScreen = new QPushButton("full-screen", this);
                auto layout = new QVBoxLayout(zoneCentrale);
              
                player->setMedia(QUrl::fromLocalFile("F:/Dropbox/_qtprojects/wontdelete/test2.mp4"));
              
                layout->addWidget(videoWidget);
                layout->addWidget(fullScreen);
              
                player->setVolume(100);
              
                QObject::connect(fullScreen, SIGNAL(clicked()), this, SLOT(on_bt_agrandi_clicked()));
              
                videoWidget->show();
                player->play();
              
              H Offline
              H Offline
              HW-Developer
              wrote on last edited by
              #14

              @mrjj It's working after i verify everything, it is the escape key event, it should be setFullScreen(False) instead of showNormal();

              I really thank you for your help. It was really nice
              Good luck and have a good days

              mrjjM 1 Reply Last reply
              2
              • H HW-Developer

                @mrjj It's working after i verify everything, it is the escape key event, it should be setFullScreen(False) instead of showNormal();

                I really thank you for your help. It was really nice
                Good luck and have a good days

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #15

                @HW-Developer
                Super.
                Happy days to you too

                1 Reply Last reply
                1
                • mrjjM mrjj

                  @HW-Developer
                  Super, i really think its just because your are not assigning a parent when you create it.
                  it then becomes a window.
                  So instead of replacing the other QVideoWidget you have, it just opens a (new) window.
                  Thats easy fixed by assigning a parent.
                  Did you based this off some sample i can look at ?

                  R Offline
                  R Offline
                  RakeshChitte
                  wrote on last edited by
                  #16

                  @mrjj @mrjj I'm also facing same problem in Qt C++ 5.12.2 in Red Hat Enterpeise Linux 7.6.
                  Please give proper solution if you can...

                  mrjjM 1 Reply Last reply
                  0
                  • R RakeshChitte

                    @mrjj @mrjj I'm also facing same problem in Qt C++ 5.12.2 in Red Hat Enterpeise Linux 7.6.
                    Please give proper solution if you can...

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #17

                    @RakeshChitte
                    Hi
                    Issue exiting fullscreen or floating window ?

                    R 1 Reply Last reply
                    0
                    • mrjjM mrjj

                      @RakeshChitte
                      Hi
                      Issue exiting fullscreen or floating window ?

                      R Offline
                      R Offline
                      RakeshChitte
                      wrote on last edited by
                      #18

                      @mrjj
                      existing full screen...

                      mrjjM 1 Reply Last reply
                      0
                      • R RakeshChitte

                        @mrjj
                        existing full screen...

                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #19

                        @RakeshChitte
                        Hi
                        Welcome back.
                        So what happens when you call showNormal(); ?

                        1 Reply Last reply
                        0

                        • Login

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • Users
                        • Groups
                        • Search
                        • Get Qt Extensions
                        • Unsolved