QT QML播放视频2次(重播)
我想播放我的视频 2 次,
当我调用函数 playVideo 时,视频播放 1 次,
当视频完成时,我使我的视频元素不可见。
然后当我回到视频时,视频没有播放,元素是一个大的黑色矩形。
如何重置视频播放器以再次播放我的视频?
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 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 to 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()
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我目前无法测试它,但也许您只需通过将
position
设置为 0 来“倒带”视频:I cannot test it at the moment, but maybe you just have to "rewind" the video by setting
position
to 0:我添加了这一行,视频现在播放了 2 次:
I've add this line and video is now playing 2 times :