summaryrefslogtreecommitdiffstats
path: root/examples/multimedia/video/recorder/Playback.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/multimedia/video/recorder/Playback.qml')
-rw-r--r--examples/multimedia/video/recorder/Playback.qml31
1 files changed, 18 insertions, 13 deletions
diff --git a/examples/multimedia/video/recorder/Playback.qml b/examples/multimedia/video/recorder/Playback.qml
index 9ae49d4d3..fdcfd1723 100644
--- a/examples/multimedia/video/recorder/Playback.qml
+++ b/examples/multimedia/video/recorder/Playback.qml
@@ -55,31 +55,36 @@ import QtQuick.Controls
Item {
id: root
- required property VideoOutput videoOutput
property bool active: false
+ property bool playing: false
+ visible: active && playing
function playUrl(url) {
- root.active = true
- if (!videoOutput) {
- console.log("videooutput is null")
- }
-
- mediaPlayer.videoOutput = videoOutput
- mediaPlayer.audioOutput = audioOutput
+ playing = true
mediaPlayer.source = url
mediaPlayer.play()
}
function stop() {
+ playing = false
mediaPlayer.stop()
- mediaPlayer.videoOutput = null
- mediaPlayer.audioOutput = null
- root.active = false
}
- AudioOutput { id: audioOutput }
+ onActiveChanged: function() {
+ if (!active)
+ stop();
+ }
- MediaPlayer { id: mediaPlayer }
+ VideoOutput {
+ anchors.fill: parent
+ id: videoOutput
+ }
+
+ MediaPlayer {
+ id: mediaPlayer
+ videoOutput: videoOutput
+ audioOutput: AudioOutput {}
+ }
HoverHandler { id: hover }