From a3a7a2786826d89e09bf79320c2689bba7b288ea Mon Sep 17 00:00:00 2001 From: Alex Belov Date: Mon, 1 Mar 2021 12:34:05 +0800 Subject: [PATCH] allow client to provide their own metadata --- Library/Sources/SCAssetExportSession.h | 3 +++ Library/Sources/SCAssetExportSession.m | 8 +++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Library/Sources/SCAssetExportSession.h b/Library/Sources/SCAssetExportSession.h index 432b82c8..fd9e313c 100644 --- a/Library/Sources/SCAssetExportSession.h +++ b/Library/Sources/SCAssetExportSession.h @@ -108,4 +108,7 @@ */ - (void)exportAsynchronouslyWithCompletionHandler:(void(^__nullable)(void))completionHandler; +- (void)exportAsynchronouslyWithCompletionHandler:(void(^__nullable)(void))completionHandler + metadata:(NSArray *__nonnull)metadata; + @end diff --git a/Library/Sources/SCAssetExportSession.m b/Library/Sources/SCAssetExportSession.m index 1dd38f5a..cfaa9e5f 100644 --- a/Library/Sources/SCAssetExportSession.m +++ b/Library/Sources/SCAssetExportSession.m @@ -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 *)metadata { _cancelled = NO; _nextAllowedVideoFrame = kCMTimeZero; NSError *error = nil; @@ -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);