Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
Material
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Dmitriy Stepanets
Material
Commits
996a1254
Commit
996a1254
authored
Dec 16, 2015
by
Daniel Dahan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CaptureView ready for prerelease testing
parent
37eec866
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
9 deletions
+22
-9
Examples/Programmatic/CaptureView/CaptureView/ViewController.swift
+11
-4
Sources/CaptureSession.swift
+6
-0
Sources/CaptureView.swift
+5
-5
No files found.
Examples/Programmatic/CaptureView/CaptureView/ViewController.swift
View file @
996a1254
...
@@ -70,6 +70,7 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
...
@@ -70,6 +70,7 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
func
captureDidStartRecordingToOutputFileAtURL
(
capture
:
CaptureSession
,
captureOutput
:
AVCaptureFileOutput
,
fileURL
:
NSURL
,
fromConnections
connections
:
[
AnyObject
])
{
func
captureDidStartRecordingToOutputFileAtURL
(
capture
:
CaptureSession
,
captureOutput
:
AVCaptureFileOutput
,
fileURL
:
NSURL
,
fromConnections
connections
:
[
AnyObject
])
{
print
(
"Capture Started Recording
\(
fileURL
)
"
)
print
(
"Capture Started Recording
\(
fileURL
)
"
)
closeButton
.
hidden
=
true
cameraButton
.
hidden
=
true
cameraButton
.
hidden
=
true
videoButton
.
hidden
=
true
videoButton
.
hidden
=
true
switchCamerasButton
.
hidden
=
true
switchCamerasButton
.
hidden
=
true
...
@@ -84,6 +85,7 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
...
@@ -84,6 +85,7 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
func
captureDidFinishRecordingToOutputFileAtURL
(
capture
:
CaptureSession
,
captureOutput
:
AVCaptureFileOutput
,
outputFileURL
:
NSURL
,
fromConnections
connections
:
[
AnyObject
],
error
:
NSError
!
)
{
func
captureDidFinishRecordingToOutputFileAtURL
(
capture
:
CaptureSession
,
captureOutput
:
AVCaptureFileOutput
,
outputFileURL
:
NSURL
,
fromConnections
connections
:
[
AnyObject
],
error
:
NSError
!
)
{
print
(
"Capture Stopped Recording
\(
outputFileURL
)
"
)
print
(
"Capture Stopped Recording
\(
outputFileURL
)
"
)
closeButton
.
hidden
=
false
cameraButton
.
hidden
=
false
cameraButton
.
hidden
=
false
videoButton
.
hidden
=
false
videoButton
.
hidden
=
false
switchCamerasButton
.
hidden
=
false
switchCamerasButton
.
hidden
=
false
...
@@ -92,10 +94,16 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
...
@@ -92,10 +94,16 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
navigationBarView
.
backgroundColor
=
MaterialColor
.
black
.
colorWithAlphaComponent
(
0.3
)
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
: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
{
MaterialAnimation
.
animationDisabled
{
self
.
navigationBarView
.
titleLabel
!.
text
=
String
(
format
:
"%02i:%02i:%02i"
,
arguments
:
[
hours
,
minutes
,
seconds
])
self
.
navigationBarView
.
titleLabel
!.
text
=
String
(
format
:
"%02i:%02i:%02i"
,
arguments
:
[
hours
,
minutes
,
seconds
])
}
}
...
@@ -104,10 +112,9 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
...
@@ -104,10 +112,9 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
/**
/**
:name: captureViewDidStopRecordTimer
: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
.
titleLabel
!.
hidden
=
true
navigationBarView
.
detailLabel
!.
hidden
=
true
navigationBarView
.
detailLabel
!.
hidden
=
true
navigationBarView
.
detailLabel
!.
textColor
=
MaterialColor
.
white
}
}
/**
/**
...
@@ -237,7 +244,7 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
...
@@ -237,7 +244,7 @@ class ViewController: UIViewController, CaptureViewDelegate, CaptureSessionDeleg
detailLabel
.
hidden
=
true
detailLabel
.
hidden
=
true
detailLabel
.
text
=
"Recording"
detailLabel
.
text
=
"Recording"
detailLabel
.
textAlignment
=
.
Center
detailLabel
.
textAlignment
=
.
Center
detailLabel
.
textColor
=
MaterialColor
.
white
detailLabel
.
textColor
=
MaterialColor
.
red
.
accent1
detailLabel
.
font
=
RobotoFont
.
regularWithSize
(
12
)
detailLabel
.
font
=
RobotoFont
.
regularWithSize
(
12
)
navigationBarView
.
detailLabel
=
detailLabel
navigationBarView
.
detailLabel
=
detailLabel
...
...
Sources/CaptureSession.swift
View file @
996a1254
...
@@ -666,6 +666,12 @@ public class CaptureSession : NSObject, AVCaptureFileOutputRecordingDelegate {
...
@@ -666,6 +666,12 @@ public class CaptureSession : NSObject, AVCaptureFileOutputRecordingDelegate {
private
func
prepareMovieOutput
()
{
private
func
prepareMovieOutput
()
{
if
session
.
canAddOutput
(
movieOutput
)
{
if
session
.
canAddOutput
(
movieOutput
)
{
session
.
addOutput
(
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
}
}
}
}
...
...
Sources/CaptureView.swift
View file @
996a1254
...
@@ -330,19 +330,19 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
...
@@ -330,19 +330,19 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
v
.
removeFromSuperview
()
v
.
removeFromSuperview
()
}
}
addSubview
(
previewView
)
insertSubview
(
previewView
,
atIndex
:
0
)
MaterialLayout
.
alignToParent
(
self
,
child
:
previewView
)
MaterialLayout
.
alignToParent
(
self
,
child
:
previewView
)
if
let
v
:
UIButton
=
captureButton
{
if
let
v
:
UIButton
=
captureButton
{
addSubview
(
v
)
insertSubview
(
v
,
atIndex
:
1
)
}
}
if
let
v
:
UIButton
=
cameraButton
{
if
let
v
:
UIButton
=
cameraButton
{
addSubview
(
v
)
insertSubview
(
v
,
atIndex
:
2
)
}
}
if
let
v
:
UIButton
=
videoButton
{
if
let
v
:
UIButton
=
videoButton
{
addSubview
(
v
)
insertSubview
(
v
,
atIndex
:
3
)
}
}
}
}
...
@@ -535,7 +535,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
...
@@ -535,7 +535,7 @@ public class CaptureView : MaterialView, UIGestureRecognizerDelegate {
resetLayer
=
MaterialLayer
(
frame
:
CGRectMake
(
0
,
0
,
150
,
150
))
resetLayer
=
MaterialLayer
(
frame
:
CGRectMake
(
0
,
0
,
150
,
150
))
resetLayer
!.
hidden
=
true
resetLayer
!.
hidden
=
true
resetLayer
!.
borderWidth
=
2
resetLayer
!.
borderWidth
=
2
resetLayer
!.
borderColor
=
MaterialColor
.
purple
.
darken
1
.
CGColor
resetLayer
!.
borderColor
=
MaterialColor
.
red
.
accent
1
.
CGColor
previewView
.
layer
.
addSublayer
(
resetLayer
!
)
previewView
.
layer
.
addSublayer
(
resetLayer
!
)
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment