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

Feature/video player #36

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
More precise timing for video snapshots
LcTwisk committed Sep 8, 2018
commit 93e67b4051a66b5ef4ed3b8f9c34c8ac7ebb27a3
2 changes: 2 additions & 0 deletions ImageViewer/Utilities.swift
Original file line number Diff line number Diff line change
@@ -5,6 +5,8 @@ import UIKit
public struct Utilities {
public static func screenShot(fromAsset asset: AVAsset, atTime time: CMTime) -> UIImage? {
let imageGenerator = AVAssetImageGenerator(asset: asset)
imageGenerator.requestedTimeToleranceBefore = kCMTimeZero
imageGenerator.requestedTimeToleranceAfter = kCMTimeZero
imageGenerator.appliesPreferredTrackTransform = true
guard let image = try? imageGenerator.copyCGImage(at: time, actualTime: nil) else { return nil }
return UIImage(cgImage: image)