tezvyn:

Generating Video Thumbnails with AVAssetImageGenerator

Source: interviewintermediate

WHAT IT TESTS: AVFoundation usage plus async UI hygiene. OUTLINE: load AVAsset, configure AVAssetImageGenerator, request the time off the main thread, hop back to update UI. RED FLAG: doing the decode synchronously on the main thread.

WHAT IT TESTS: practical AVFoundation knowledge and threading discipline. ANSWER OUTLINE: create an AVAsset for the URL, build an AVAssetImageGenerator, set appliesPreferredTrackTransform true so orientation is correct, and call the async copyCGImage API for a CMTime. Set maximumSize to avoid decoding a full-resolution frame, use a tolerance to let it snap to a nearby keyframe for speed, never block the main thread, and dispatch the resulting UIImage back to the main queue. RED FLAG: synchronous decoding on the main thread, freezing scrolling.

Read the original → interview

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Generating Video Thumbnails with AVAssetImageGenerator · Tezvyn