diff options
-rw-r--r-- | examples/multimedia/video/recorder/Playback.qml | 31 | ||||
-rw-r--r-- | examples/multimedia/video/recorder/main.qml | 10 |
2 files changed, 22 insertions, 19 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 } diff --git a/examples/multimedia/video/recorder/main.qml b/examples/multimedia/video/recorder/main.qml index 42158cf6e..6e32dfc80 100644 --- a/examples/multimedia/video/recorder/main.qml +++ b/examples/multimedia/video/recorder/main.qml @@ -68,6 +68,7 @@ Window { VideoOutput { id: videoOutput anchors.fill: parent + visible: !playback.playing } Popup { @@ -81,7 +82,7 @@ Window { recorder: recorder audioInput: controls.audioInput camera: controls.camera - videoOutput: playback.active ? null : videoOutput + videoOutput: videoOutput } MediaRecorder { @@ -100,13 +101,10 @@ Window { Playback { id: playback anchors { - top: parent.top - left: parent.left - right: parent.right - bottom: controls.capturesVisible ? mediaListFrame.top : controlsFrame.top + fill: parent margins: 50 } - videoOutput: videoOutput + active: controls.capturesVisible } Frame { |