显示效果:
代码:
import QtQuick 2.0
import QtMultimedia 5.4
Rectangle {
color: "black"
anchors.fill: parent
MediaPlayer {
id: mediaPlayer
source: "file:///c:/test.mp4"
autoPlay: true
}
VideoOutput {
id: video
anchors.fill: parent
source: mediaPlayer
}
}
注意:
最主要的就是source的路径要写对了. 本地文件前面, 记得加上file:/// , 需要三个斜杠哦..