MediaPlayerThe MediaPlayer type allows you to add media playback to a scene. More... Detailed DescriptionMediaPlayer is part of the QtMultimedia 5.0 module. import QtQuick 2.0 import QtMultimedia 5.0 Text { text: "Click Me!"; font.pointSize: 24; width: 150; height: 50; MediaPlayer { id: playMusic source: "music.wav" } MouseArea { id: playArea anchors.fill: parent onPressed: { playMusic.play() } } } You can use MediaPlayer by itself to play audio content (like Audio), or you can use it in conjunction with a VideoOutput for rendering video. import QtQuick 2.0 import QtMultimedia 5.0 Item { MediaPlayer { id: mediaplayer source: "groovy_video.mp4" } VideoOutput { anchors: parent.fill source: mediaplayer } MouseArea { id: playArea anchors.fill: parent onPressed: mediaplayer.play(); } } See also VideoOutput. |