-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.qml
executable file
·63 lines (53 loc) · 1.7 KB
/
main.qml
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
53
54
55
56
57
58
59
60
61
62
63
import QtQuick 2.4
import QtMultimedia 5.6
import Eos.Window 0.1
import Eos.Items 0.1
import WebOS.Global 1.0
WebOSWindow {
id: root
visible: true
width: 1920
height: 1080
keyMask: WebOSWindow.KeyMaskBack | keyMask
Component.onCompleted: {
// Window will handle back key event only when this set to true on my TV.
windowProperties["_WEBOS_ACCESS_POLICY_KEYS_BACK"] = "true"
}
Item {
anchors.fill: parent
focus: true
MediaPlayer {
id: mediaplayer
// file://, http(s?):// are confirmed to be supported. More to find.
source: "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4"
}
VideoOutput {
anchors.fill: parent
source: mediaplayer
// This is the key to display video. This sounds quite familiar to SurfaceView on Android.
// Also, the hierarchy is not important I guess. You can put this as a sibling of VideoOutput
PunchThrough {
x: 0; y: 0; z: -1
width: parent.width
height: parent.height
}
}
MouseArea {
id: playArea
anchors.fill: parent
onPressed: {
if (mediaplayer.playbackState == MediaPlayer.PlayingState) {
mediaplayer.pause();
} else {
mediaplayer.play();
}
}
}
Keys.onPressed: {
// webOS related key codes are defined in qweboskeyextension.h
if (event.key == WebOS.Key_webOS_Back) {
Qt.quit()
}
}
}
}