1 import Qt 4.6 |
|
2 |
|
3 Video { |
|
4 id: video |
|
5 width: 800 |
|
6 height: 600 |
|
7 anchors.fill: parent |
|
8 fillMode: Video.PreserveAspectFit |
|
9 source: videoUrl |
|
10 |
|
11 Text { |
|
12 text: video.title |
|
13 anchors.horizontalCenter: parent.horizontalCenter |
|
14 anchors.top: parent.top |
|
15 } |
|
16 |
|
17 Item { |
|
18 x: 0 |
|
19 y: 470 |
|
20 width: 800 |
|
21 height: 120 |
|
22 |
|
23 Image { |
|
24 source: "qrc:/images/play.png" |
|
25 x: 375 |
|
26 y: 25 |
|
27 |
|
28 visible: !video.playing || video.paused |
|
29 |
|
30 MouseRegion { |
|
31 anchors.fill: parent |
|
32 onClicked: video.play() |
|
33 } |
|
34 } |
|
35 |
|
36 Image { |
|
37 source: "qrc:/images/pause.png" |
|
38 x: 375 |
|
39 y: 25 |
|
40 |
|
41 visible: video.playing && !video.paused |
|
42 |
|
43 MouseRegion { |
|
44 anchors.fill: parent |
|
45 onClicked: video.pause() |
|
46 } |
|
47 } |
|
48 |
|
49 Image { |
|
50 source: "qrc:/images/stop.png" |
|
51 x: 305 |
|
52 y: 35 |
|
53 |
|
54 visible: video.playing |
|
55 |
|
56 MouseRegion { |
|
57 anchors.fill: parent |
|
58 onClicked: video.stop() |
|
59 } |
|
60 } |
|
61 |
|
62 Image { |
|
63 source: "qrc:/images/mute.png" |
|
64 x: 465 |
|
65 y: 40 |
|
66 |
|
67 MouseRegion { |
|
68 anchors.fill: parent |
|
69 onClicked: { |
|
70 video.muted = !video.muted; |
|
71 } |
|
72 } |
|
73 |
|
74 Image { |
|
75 source: "qrc:/images/muted.png" |
|
76 anchors.fill: parent |
|
77 |
|
78 visible: video.muted |
|
79 } |
|
80 } |
|
81 |
|
82 Item { |
|
83 x: 535 |
|
84 y: 50 |
|
85 width: 230 |
|
86 height: 40 |
|
87 |
|
88 Image { |
|
89 source: "qrc:/images/volume.png" |
|
90 x: 0 |
|
91 y: 5 |
|
92 |
|
93 MouseRegion { |
|
94 anchors.fill: parent |
|
95 |
|
96 onClicked: video.volume = (mouse.x - 15) / 200 |
|
97 } |
|
98 } |
|
99 |
|
100 Image { |
|
101 source: "qrc:/images/volume-grip.png" |
|
102 x: video.volume * 200 |
|
103 y: 0 |
|
104 |
|
105 MouseRegion { |
|
106 anchors.fill: parent |
|
107 drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 0; drag.maximumX: 200 |
|
108 |
|
109 onPositionChanged: video.volume = parent.x / 200 |
|
110 } |
|
111 } |
|
112 } |
|
113 |
|
114 Item { |
|
115 x: 5 |
|
116 y: 0 |
|
117 width: 790 |
|
118 height: 30 |
|
119 |
|
120 Image { |
|
121 source: "qrc:/images/progress.png" |
|
122 x: 0 |
|
123 y: 5 |
|
124 |
|
125 MouseRegion { |
|
126 anchors.fill: parent |
|
127 |
|
128 onClicked: video.position = (mouse.x - 15) * video.duration / 760 |
|
129 enabled: video.duration > 0 |
|
130 } |
|
131 } |
|
132 |
|
133 Image { |
|
134 source: "qrc:/images/progress-grip.png" |
|
135 x: 760 * video.position / video.duration |
|
136 y: 0 |
|
137 visible: video.duration > 0 |
|
138 |
|
139 MouseRegion { |
|
140 anchors.fill: parent |
|
141 drag.target: parent; drag.axis: "XAxis"; drag.minimumX: 0; drag.maximumX: 760 |
|
142 |
|
143 onReleased: video.position = parent.x / 760 |
|
144 } |
|
145 } |
|
146 } |
|
147 } |
|
148 } |
|