Loading a .mov file results in an automatically zoom from the QMediaPlayer



  • Hi,

    I am heading a problem at my program. Normaly I am developing on a Windows Computer, but right now I am on a Mac.
    If I set a .mov File, the File automaticaly zoom into the video, so it does not keep it size.
    Did somebody handle the problem already?

    Example Code:

    videoWidgetTransform     = new QVideoWidget(_pMainWindow);
    videoWidgetTransform->setParent(_pMainUi->videowidget);
    
     _videoPlayer =  new QMediaPlayer();
     _videoPlayer->setVideoOutput(videoWidgetTransform);
    
      setMedia(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)+"/myData/Videos/Wildlife.mov");
    

  • Lifetime Qt Champion

    Hi,

    From the looks of it you are re-parenting your QVideoWidget to what seems to be another video widget instance. What exactly are you trying to achieve ?



  • @SGaist

    _pMainUi->videowidget is a normal widget in my Ui. I am working with the designer, so I can not insert a QVideoWidget directly... Next time I gonna hard code my Ui.

     mMediaPlayer = new QMediaPlayer(this);
     mVideoWidget = new QVideoWidget(this);
     mMediaPlayer->setVideoOutput(mVideoWidget);
    
     ui->stackedWidget->insertWidget(0,mVideoWidget);
     ui->stackedWidget->setCurrentIndex(0);
    
     mMediaPlayer->setMedia(QUrl::fromLocalFile(QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation)+"/HEGData/Videos/Wildlife.mov"));
    
     mMediaPlayer->play();
    

    ... works properly

    I found the reason, I implemented a video ratio function to get rid of the black borders. Is there a function to stop the .mov video from scaling itself, on my Windows, the .wmv videos did not do that. If I am changing my splitter, which is resulting in a smaller or bigger video, it changes itself to the correct size and then, after 0.5 seconds it zooms in again.
    Any idea anyone?


  • Lifetime Qt Champion

    Nothing forbids you to add a layout to that widget and then add the video widget to it.



  • @SGaist

    But it makes it more complicated?
    I am still facing this issue, on my windows computer everything is working fine. But I want to deploy the program for ios as well. I guess I will face this error there as well.


  • Lifetime Qt Champion

    Why more complicated ? In your designer UI you can set a layout on _pMainUi->videowidget and then in your code you retrieve that layout and add videoWidgetTransform.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.