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");
-
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 ?
-
_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? -
Nothing forbids you to add a layout to that widget and then add the video widget to it.
-
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 addvideoWidgetTransform
.