when the software is opened in qml, the first frame of the video does not appear. I am using videooutput and mediaplayer. When I researched, they suggested that I set the autoplay and autoload variables to true. but in the latest version I am using autoload and autoplay are not available in mediaplayer. How can I make the first frame appear on the screen even though I did not start the video when the software was first opened?
import QtQuick
import QtQuick.Controls
import QtMultimedia
import QtQuick.Layouts
import QtQuick.Controls.Material
Item {
id: videoContainer
anchors.fill: parent
Material.accent: sliderColor
Rectangle {
anchors.fill: parent
color: mainBackgroundColor
}
MediaPlayer {
id: mediaPlayer
videoOutput: videoOutput
source: "vid1.mp4"
}
ColumnLayout {
anchors.fill: parent
VideoOutput {
id: videoOutput
fillMode: VideoOutput.PreserveAspectCrop
Layout.fillHeight: true; Layout.fillWidth: true
}
RowLayout {
Layout.leftMargin: 5; Layout.rightMargin: 5
Button {
id: playPauseButton
Layout.fillHeight: true; Layout.fillWidth: true
Material.background: '#148ca3'
text: mediaPlayer.playbackState === MediaPlayer.PlayingState ? "Durdur" : "Başlat"
onClicked: {
if (mediaPlayer.playbackState === MediaPlayer.PlayingState) {
mediaPlayer.pause()
} else {
mediaPlayer.play()
}
}
}
Slider {
id: progressBar
Layout.fillHeight: true; Layout.fillWidth: true
from: 0
to: mediaPlayer.duration
value: mediaPlayer.position
onValueChanged: mediaPlayer.position = value
}
}
}
}
I had the same problem. I ended up calling:
(my code is C++ not QML)