Skip to content

Instantly share code, notes, and snippets.

View martinwrudolf's full-sized avatar

Marty Rudolf martinwrudolf

View GitHub Profile
@martinwrudolf
martinwrudolf / VideoHelper.swift
Created February 9, 2024 04:32 — forked from Martini024/VideoHelper.swift
SwiftUI: Rewrite iOS Photos Video Scrubber
import Foundation
import AVKit
class VideoHelper {
static func getThumbnail(from player: AVPlayer, at time: CMTime) -> CGImage? {
do {
guard let currentItem = player.currentItem else { return nil }
let asset = currentItem.asset
let imgGenerator = AVAssetImageGenerator(asset: asset)