Skip to content

Commit

Permalink
allow client to provide their own metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
Lenhador committed Mar 1, 2021
1 parent 2a7dee5 commit a3a7a27
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 3 additions & 0 deletions Library/Sources/SCAssetExportSession.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,7 @@
*/
- (void)exportAsynchronouslyWithCompletionHandler:(void(^__nullable)(void))completionHandler;

- (void)exportAsynchronouslyWithCompletionHandler:(void(^__nullable)(void))completionHandler
metadata:(NSArray<AVMutableMetadataItem *> *__nonnull)metadata;

@end
8 changes: 7 additions & 1 deletion Library/Sources/SCAssetExportSession.m
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,12 @@ - (void)_setupVideoUsingTracks:(NSArray *)videoTracks {
}

- (void)exportAsynchronouslyWithCompletionHandler:(void (^)(void))completionHandler {
[self exportAsynchronouslyWithCompletionHandler:completionHandler
metadata:[SCRecorderTools assetWriterMetadata]];
}

- (void)exportAsynchronouslyWithCompletionHandler:(void (^)(void))completionHandler
metadata:(NSArray<AVMutableMetadataItem *> *)metadata {
_cancelled = NO;
_nextAllowedVideoFrame = kCMTimeZero;
NSError *error = nil;
Expand All @@ -664,7 +670,7 @@ - (void)exportAsynchronouslyWithCompletionHandler:(void (^)(void))completionHand

_writer = [AVAssetWriter assetWriterWithURL:self.outputUrl fileType:self.outputFileType error:&error];
_writer.shouldOptimizeForNetworkUse = _shouldOptimizeForNetworkUse;
_writer.metadata = [SCRecorderTools assetWriterMetadata];
_writer.metadata = metadata;

EnsureSuccess(error, completionHandler);

Expand Down

0 comments on commit a3a7a27

Please sign in to comment.