Quantcast
Channel: Qt DevNet forums: Qt Quick 1283365070**
Viewing all articles
Browse latest Browse all 4972

Can't get QML to playback .mp4 videos

$
0
0
Hello – QML newbie here. I am attempting to to create a trivial app for playback of video files. The code I have works fine for .wmv files, but when I try to playback an .mp4 file, nothing plays. Screen stays black. I am using Qt 5.2 running on Windows 7. I can playback the .mp4 files with no problem in Windows Media Viewer, so I believe I have the right codecs installed. Qt does not report any errors and the video component reports that it is playing when I query it’s status. My code as follows. Any ideas what I need to do? import QtQuick 2.2 import QtMultimedia 5.0 import QtQuick.Controls 1.1 import QtQuick.Dialogs 1.1     Rectangle {     width: 800     height: 600     color: "black"             FileDialog {         id:  fbrowser         title:  "Please select a video file"     }         Row {         id:  buttonRow                 Button {             id:  goButton             text: "Start"             onClicked:  {                 videoPlayer.source =  videoFileName.text;                 videoPlayer.play();             }         }                 Button {             id: stopButton             text: "Stop"             onClicked: {videoPlayer.stop(); }         }                 Button {             id:  chooseFileButton             text: "Select Video File..."             onClicked: {fbrowser.open();}         }                 TextField {             id:  videoFileName             width: 450             text:  fbrowser.fileUrl         }     }         Rectangle {         id:  videoRect                 anchors {left: parent.left; top: buttonRow.bottom; topMargin: 5; right:  parent.right; bottom:  parent.bottom}         color:  "transparent"                 Video {             id: videoPlayer             focus: true             anchors.fill: parent         }     } }

Viewing all articles
Browse latest Browse all 4972

Latest Images

Trending Articles



Latest Images