dev-labs-bg / swift-video-generator

MIT License
639 stars 121 forks source link

Suggestion: Output File Type as Input #73

Open raggedy-coder opened 4 years ago

raggedy-coder commented 4 years ago

Great library! I recently came across this problem where the video generated wasn't viewable on Safari so it got me thinking if if's feasible to add another parameter in the mix for situations like these. I didn't test the proposed code, but the idea is there.

Current: open func mergeVideoWithAudio(videoUrl: URL, audioUrl: URL, outcome: @escaping (Result<URL, Error>) -> Void) {

"\(VideoGenerator.fileName).m4v"

exportSession.outputFileType = AVFileType.mp4

Proposed: open func mergeVideoWithAudio(videoUrl: URL, audioUrl: URL, outputFileType: AVFileType = .m4v, outcome: @escaping (Result<URL, Error>) -> Void) {

"\(VideoGenerator.fileName)."\(outputFileType.rawValue)"

exportSession.outputFileType = outputFileType