Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
2971c85
Pause/resume video recording for Android
huulbaek Mar 21, 2019
3e87cac
Specify type
bparrishMines Aug 1, 2019
d99f9d0
Merge branch 'master' of github.com:flutter/plugins into huulbaek/pau…
bparrishMines Aug 1, 2019
474604d
Merge branch 'master' of github.com:flutter/plugins into huulbaek/pau…
bparrishMines Aug 5, 2019
423adcd
Add pausing and resuming to example app
bparrishMines Aug 6, 2019
0214093
iOS side of pausing/resuming
bparrishMines Aug 6, 2019
7216d4a
Merge branch 'master' of github.com:flutter/plugins into huulbaek/pau…
bparrishMines Aug 7, 2019
113cd55
More documentation
bparrishMines Aug 7, 2019
5664547
Version bump
bparrishMines Aug 7, 2019
9210c26
Merge branch 'master' of github.com:flutter/plugins into huulbaek/pau…
bparrishMines Aug 12, 2019
3f47c60
Add video pausing and resuming
bparrishMines Aug 14, 2019
5baee78
get pausing and recording to work for no audio
bparrishMines Aug 15, 2019
da26df1
It works
bparrishMines Aug 16, 2019
b56d1fb
Merge branch 'pauseresume' of github.com:huulbaek/plugins into huulba…
bparrishMines Aug 16, 2019
542ee3d
Formatting
bparrishMines Aug 16, 2019
5023773
Add test for pausing and resuming
bparrishMines Aug 19, 2019
6dbbf8d
Merge branch 'master' into pauseresume
bparrishMines Aug 19, 2019
ca47f38
Call success outside try catch block
bparrishMines Aug 19, 2019
c758b26
formatting
bparrishMines Aug 19, 2019
70e1b13
Merge branch 'pauseresume' of github.com:huulbaek/plugins into huulba…
bparrishMines Aug 19, 2019
8ff306f
Disable audio in test and call result on iOS
bparrishMines Aug 19, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
It works
  • Loading branch information
bparrishMines committed Aug 16, 2019
commit da26df13f2adbecf29c868f57be6d2fdbd5d3d66
29 changes: 14 additions & 15 deletions packages/camera/ios/Classes/CameraPlugin.m
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,6 @@ - (void)captureOutput:(AVCaptureOutput *)output

CFRetain(sampleBuffer);
CMTime currentSampleTime = CMSampleBufferGetPresentationTimeStamp(sampleBuffer);
CMTime dur = CMSampleBufferGetDuration(sampleBuffer);

if (_videoWriter.status != AVAssetWriterStatusWriting) {
[_videoWriter startWriting];
Expand All @@ -446,40 +445,40 @@ - (void)captureOutput:(AVCaptureOutput *)output
if (_videoTimeOffset.value == 0) {
_videoTimeOffset = CMTimeSubtract(currentSampleTime, _lastVideoSampleTime);
} else {
CMTime adjustedSampleTime = CMTimeSubtract(currentSampleTime, _videoTimeOffset);
CMTime offset = CMTimeSubtract(adjustedSampleTime, _lastVideoSampleTime);
CMTime offset = CMTimeSubtract(currentSampleTime, _lastVideoSampleTime);
_videoTimeOffset = CMTimeAdd(_videoTimeOffset, offset);
}
}

if (dur.value > 0) {
_lastVideoSampleTime = CMTimeAdd(currentSampleTime, dur);
} else {
_lastVideoSampleTime = currentSampleTime;
return;
}

_lastVideoSampleTime = currentSampleTime;

CVPixelBufferRef nextBuffer = CMSampleBufferGetImageBuffer(sampleBuffer);
CMTime nextSampleTime = CMTimeSubtract(_lastVideoSampleTime, _videoTimeOffset);
[_videoAdaptor appendPixelBuffer:nextBuffer withPresentationTime:nextSampleTime];
} else {
CMTime dur = CMSampleBufferGetDuration(sampleBuffer);

if (dur.value > 0) {
currentSampleTime = CMTimeAdd(currentSampleTime, dur);
}

if (_audioIsDiconnected) {
_audioIsDiconnected = NO;

if (_audioTimeOffset.value == 0) {
_audioTimeOffset = CMTimeSubtract(currentSampleTime, _lastAudioSampleTime);
} else {
CMTime adjustedSampleTime = CMTimeSubtract(currentSampleTime, _audioTimeOffset);
CMTime offset = CMTimeSubtract(adjustedSampleTime, _lastAudioSampleTime);
CMTime offset = CMTimeSubtract(currentSampleTime, _lastAudioSampleTime);
_audioTimeOffset = CMTimeAdd(_audioTimeOffset, offset);
}
}

if (dur.value > 0) {
_lastAudioSampleTime = CMTimeAdd(currentSampleTime, dur);
} else {
_lastAudioSampleTime = currentSampleTime;
return;
}

_lastAudioSampleTime = currentSampleTime;

if (_audioTimeOffset.value != 0) {
CFRelease(sampleBuffer);
sampleBuffer = [self adjustTime:sampleBuffer by:_audioTimeOffset];
Expand Down