Skip to content

Add property for video size #1

@AndrewHartAR

Description

@AndrewHartAR

This library is awesome. Can't wait to see it grow.

I'm using this in a messaging app, and the only part missing is I need to know the size of the video, so I can lay it out appropriately. Using AVAsset for this inevitably causes a delay as it loads in the asset. If this property could be added that'd be awesome. Right now I'm doing it using AVAsset as follows:

extension AVAsset {
    func size() -> CGSize? {
        let tracks = self.tracksWithMediaType(AVMediaTypeVideo)

        if tracks.count > 0 {
            return tracks[0].naturalSize
        } else {
            return nil
        }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions