AVAsset

class AVAsset : NSObject, NSCopying, AVAsynchronousKeyValueLoading
  • Mechanica

    Generates a thumbnail image.

    Example:

    let url = URL(string: "https://link/to/video.mp4")!
    let asset = AVAsset(url: url)
    let thumbnail = asset.thumbnail(fromTime: 5)
    

    Throws

    Throws an error if no thumbnail could be created.

    Note

    This function may take some time to complete: it’s recommended to dispatch the call on another queue if the thumbnail is not generated from a local resource.

    Declaration

    Swift

    public func thumbnail(fromTime time: Float64 = 0) throws -> Image

    Parameters

    time

    Seconds into the video where the image should be generated.

    Return Value

    A thumbnail image.