Advertisement
Guest User

Untitled

a guest
May 30th, 2015
381
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QML 3.43 KB | None | 0 0
  1. import QtQuick 2.0
  2. import QtMultimedia 5.4
  3. import QtGraphicalEffects 1.0
  4.  
  5. Rectangle {
  6.     width: parent.width
  7.     height: parent.height
  8.  
  9.     PanelNotes {
  10.         id: panelNotes
  11.         z: 100
  12.         originalWidth: video.width / 4
  13.         height: video.height - 30
  14.     }
  15.  
  16.     Camera {
  17.         id: camera
  18.         captureMode: Camera.CaptureVideo
  19.         videoRecorder.audioEncodingMode: CameraRecorder.ConstantBitRateEncoding
  20.         videoRecorder.audioBitRate: 128000
  21.         videoRecorder.mediaContainer: "mp4"
  22.         videoRecorder.videoCodec: "h264"
  23.         videoRecorder.frameRate: 24
  24.         videoRecorder.resolution: Qt.size(1920, 1080)
  25.         position: Camera.FrontFace
  26.         //videoRecorder.outputLocation: "/Users/dfranca"
  27.     }
  28.  
  29.     VideoOutput {
  30.         id: video
  31.         width: parent.width
  32.         height: parent.height
  33.  
  34.         source: camera
  35.     }
  36.  
  37.     Rectangle {
  38.         id: controls
  39.         anchors.right: video.right
  40.         anchors.top: parent.top
  41.         width: 60
  42.         height: parent.height
  43.         z: 100
  44.         opacity: 0.5
  45.         color: "#DEDEDE"
  46.  
  47.         Rectangle {
  48.             id: parentButton
  49.  
  50.             radius: recordButton.radius
  51.             width: recordButton.width + 5
  52.             height: recordButton.height + 5
  53.             color: "#454545"
  54.  
  55.             anchors.centerIn: parent
  56.  
  57.             Rectangle {
  58.                 id: recordButton
  59.                 radius: 50
  60.                 width: 40
  61.                 height: 40
  62.                 color: "red"
  63.  
  64.                 anchors.centerIn: parent
  65.  
  66.                 states: [
  67.                     State {
  68.                         name: "stopped"; when: camera.videoRecorder.recorderState === CameraRecorder.StoppedState
  69.                         PropertyChanges {
  70.                             target: recordButton; radius: 50;
  71.                         }
  72.                         /*PropertyChanges {
  73.                             target: controls; opacity: 1;
  74.                         }*/
  75.  
  76.                     },
  77.                     State {
  78.                         name: "recording"; when: camera.videoRecorder.recorderState === CameraRecorder.RecordingState
  79.                         PropertyChanges {
  80.                             target: recordButton; radius: 0;
  81.                         }
  82.                         /*PropertyChanges {
  83.                             target: controls; opacity: 0.2;
  84.                         }*/
  85.  
  86.                     }
  87.                 ]
  88.  
  89.                 transitions: Transition {
  90.                     NumberAnimation {
  91.                         properties: "radius"; easing.type: Easing.Linear
  92.                         duration: 300
  93.                     }
  94.                 }
  95.  
  96.                 MouseArea {
  97.                     anchors.fill: parent
  98.  
  99.                     onClicked: {
  100.                         if (camera.videoRecorder.recorderState === CameraRecorder.StoppedState)
  101.                         {
  102.                             console.log("Starting record")
  103.                             camera.videoRecorder.record();
  104.                         }
  105.                         else
  106.                         {
  107.                             console.log("Stopping record")
  108.                             camera.videoRecorder.stop();
  109.                             console.log("Saved at: " + camera.videoRecorder.actualLocation)
  110.                         }
  111.                     }
  112.                 }
  113.             }
  114.         }
  115.     }
  116. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement