blob: 04af1318645f229d2b1090e8f79c6d99f48c1ba7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
// Copyright (C) 2023 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
import QtQuick
import QtMultimedia
Rectangle {
id: root
width: 600
height: 800
color: "black"
Component {
id: videoOutputComponent
Item {
objectName: "videoPlayer"
property alias mediaPlayer: mediaPlayer
property alias videoOutput: videoOutput
property alias videoSink: videoOutput.videoSink
property alias playbackState: mediaPlayer.playbackState
property alias error: mediaPlayer.error
MediaPlayer {
id: mediaPlayer
objectName: "mediaPlayer"
source: "qrc:/testdata/colors.mp4"
}
VideoOutput {
id: videoOutput
objectName: "videoOutput"
anchors.fill: parent
}
}
}
Loader {
id: loader
objectName: "loader"
sourceComponent: videoOutputComponent
anchors.fill: parent
active: false
onActiveChanged: {
if (active) {
loader.item.mediaPlayer.videoOutput = loader.item.videoOutput
loader.item.mediaPlayer.play()
}
}
}
}
|