Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

removeSegmentAtIndex: deleteFile: is error #60

Closed
dengbinhero opened this issue Aug 31, 2014 · 2 comments
Closed

removeSegmentAtIndex: deleteFile: is error #60

dengbinhero opened this issue Aug 31, 2014 · 2 comments

Comments

@dengbinhero
Copy link

I use cocoapod to added : pod 'SCRecorder', '~> 2.0.14'
and i use the methed:
removeSegmentAtIndex: deleteFile:
to remove a segment,

after i removed a segment, and i updateTimeRecordedLabel, and refresh the correct time use under code:
if (_recorder.recordSession != nil) {
currentTime = _recorder.recordSession.currentRecordDuration;
}

self.timeRecordedLabel.text = [NSString stringWithFormat:@"%.2f S", CMTimeGetSeconds(currentTime)];

but the time error, the time was not changed, when i removeSegmentAtIndex twice! the time was changed!!

@rFlex
Copy link
Owner

rFlex commented Sep 10, 2014

Can you show me more code? Thanks!

@louistran99
Copy link

@rFlex @dengbinhero is correct. The _currentRecordDuration ivar is incorrect when you delete a segment. I've made the correction to this method with the below code.

  • (void)removeSegmentAtIndex:(NSInteger)segmentIndex deleteFile:(BOOL)deleteFile {
    if (deleteFile) {
    NSURL *fileUrl = [_recordSegments objectAtIndex:segmentIndex];
    [self removeFile:fileUrl];
    }

    [_recordSegments removeObjectAtIndex:segmentIndex];
    _currentRecordDuration = self.assetRepresentingRecordSegments.duration;
    // [self recomputeRecordDuration];
    }

@rFlex rFlex closed this as completed Oct 2, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants