Set device property when we create source.
[harmattan/cameraplus] / qml / VideoPlayerPage.qml
index 6e7eaae..759b097 100644 (file)
@@ -25,16 +25,18 @@ import com.nokia.meego 1.1
 import QtMultimediaKit 1.1
 import CameraPlus 1.0
 
+// TODO: error reporting
+
 CameraPage {
         id: page
 
         property bool popTwice: false
         controlsVisible: false
-        policyMode: CameraResources.PostCapture
-        needsPipeline: false
+        policyMode: CameraResources.None
         standbyVisible: false
 
         property alias source: video.source
+
         function play() {
                 video.play();
         }
@@ -48,6 +50,13 @@ CameraPage {
                 onClicked: toolBar.show = !toolBar.show
         }
 
+        Timer {
+                id: hideTimer
+                running: toolBar.show
+                interval: 3000
+                onTriggered: toolBar.show = false;
+        }
+
                Video {
                 id: video
                 anchors.fill: parent
@@ -57,7 +66,7 @@ CameraPage {
                                 video.pause();
                         }
                         else {
-                                video.play();
+                                page.play();
                         }
                 }
 
@@ -80,7 +89,6 @@ CameraPage {
                 }
         }
 
-        // TODO: auto-hide this
         CameraToolBar {
                 id: toolBar
 
@@ -124,11 +132,17 @@ CameraPage {
                                         if (!slider.pressed) {
                                                 video.position = slider.value;
                                         }
+
+                                        hideTimer.restart();
                                 }
                         },
                         ToolIcon {
                                 id: control
-                                iconId: !video.paused ? "icon-m-toolbar-mediacontrol-pause-white" : "icon-m-toolbar-mediacontrol-play-white"; onClicked: video.toggle();
+                                iconId: !video.paused ? "icon-m-toolbar-mediacontrol-pause-white" : "icon-m-toolbar-mediacontrol-play-white"
+                                onClicked: {
+                                        video.toggle();
+                                        hideTimer.restart();
+                                }
                         }
                 ]
         }