QT QML play Video 2 times (replay)
I would like to play my video 2 times,
When i call the function playVideo the video is play 1 time,
When the video is finish, i make my video element not visible.
Then when i come back to video, the video is not playing, the element is a big black rectangle.
How can i reset video player 开发者_如何学JAVAto play my video again ?
Video {
id: video
width: parent.width;
height: parent.height;
source: "../blow.mp4"
z:500
visible: false
signal endOfMedia()
onStatusChanged: {
if(video.status == Video.EndOfMedia)
{
video.stop();
video.visible = false
}
}
}
function playVideo(){
video.visible = true
video.play()
}
I cannot test it at the moment, but maybe you just have to "rewind" the video by setting position
to 0:
function playVideo() {
video.visible = true;
video.position = 0; // back to start
video.play();
}
I've add this line and video is now playing 2 times :
autoLoad: false
精彩评论