Commit 996a1254 by Daniel Dahan

CaptureView ready for prerelease testing

parent 37eec866
......@@ -70,6 +70,7 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
func captureDidStartRecordingToOutputFileAtURL(capture: CaptureSession, captureOutput: AVCaptureFileOutput, fileURL: NSURL, fromConnections connections: [AnyObject]) {
print("Capture Started Recording \(fileURL)")
closeButton.hidden = true
cameraButton.hidden = true
videoButton.hidden = true
switchCamerasButton.hidden = true
......@@ -84,6 +85,7 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
func captureDidFinishRecordingToOutputFileAtURL(capture: CaptureSession, captureOutput: AVCaptureFileOutput, outputFileURL: NSURL, fromConnections connections: [AnyObject], error: NSError!) {
print("Capture Stopped Recording \(outputFileURL)")
closeButton.hidden = false
cameraButton.hidden = false
videoButton.hidden = false
switchCamerasButton.hidden = false
......@@ -92,10 +94,16 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
navigationBarView.backgroundColor = MaterialColor.black.colorWithAlphaComponent(0.3)
}
func captureViewDidStartRecordTimer(captureView: CaptureView) {
navigationBarView.titleLabel!.text = "00:00:00"
navigationBarView.titleLabel!.hidden = false
navigationBarView.detailLabel!.hidden = false
}
/**
:name: captureViewDidUpdateRecordTimer
*/
func captureViewDidUpdateRecordTimer(captureView: CaptureView, duration: CMTime, time: Double, hours: Int, minutes: Int, seconds: Int) {
func captureViewDidUpdateRecordTimer(captureView: CaptureView, hours: Int, minutes: Int, seconds: Int) {
MaterialAnimation.animationDisabled {
self.navigationBarView.titleLabel!.text = String(format: "%02i:%02i:%02i", arguments: [hours, minutes, seconds])
}
......@@ -104,10 +112,9 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
/**
:name: captureViewDidStopRecordTimer
*/
func captureViewDidStopRecordTimer(captureView: CaptureView, duration: CMTime, time: Double, hours: Int, minutes: Int, seconds: Int) {
func captureViewDidStopRecordTimer(captureView: CaptureView, hours: Int, minutes: Int, seconds: Int) {
navigationBarView.titleLabel!.hidden = true
navigationBarView.detailLabel!.hidden = true
navigationBarView.detailLabel!.textColor = MaterialColor.white
}
/**
......@@ -237,7 +244,7 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
detailLabel.hidden = true
detailLabel.text = "Recording"
detailLabel.textAlignment = .Center
detailLabel.textColor = MaterialColor.white
detailLabel.textColor = MaterialColor.red.accent1
detailLabel.font = RobotoFont.regularWithSize(12)
navigationBarView.detailLabel = detailLabel
......
......@@ -666,6 +666,12 @@ public class CaptureSession : NSObject, AVCaptureFileOutputRecordingDelegate {
private func prepareMovieOutput() {
if session.canAddOutput(movieOutput) {
session.addOutput(movieOutput)
// By calling this, it removes the stutter that occurs
// when calling the record button.
let connection: AVCaptureConnection = self.movieOutput.connectionWithMediaType(AVMediaTypeVideo)
connection.videoOrientation = self.currentVideoOrientation
connection.preferredVideoStabilizationMode = .Auto
}
}
......
......@@ -330,19 +330,19 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
v.removeFromSuperview()
}
addSubview(previewView)
insertSubview(previewView, atIndex: 0)
MaterialLayout.alignToParent(self, child: previewView)
if let v: UIButton = captureButton {
addSubview(v)
insertSubview(v, atIndex: 1)
}
if let v: UIButton = cameraButton {
addSubview(v)
insertSubview(v, atIndex: 2)
}
if let v: UIButton = videoButton {
addSubview(v)
insertSubview(v, atIndex: 3)
}
}
......@@ -535,7 +535,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
resetLayer = MaterialLayer(frame: CGRectMake(0, 0, 150, 150))
resetLayer!.hidden = true
resetLayer!.borderWidth = 2
resetLayer!.borderColor = MaterialColor.purple.darken1.CGColor
resetLayer!.borderColor = MaterialColor.red.accent1.CGColor
previewView.layer.addSublayer(resetLayer!)
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment