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

Orientation problem: some videos are rotated by 90 or 180 degrees #85

Open
ppave opened this issue Mar 26, 2023 · 0 comments
Open

Orientation problem: some videos are rotated by 90 or 180 degrees #85

ppave opened this issue Mar 26, 2023 · 0 comments

Comments

@ppave
Copy link

ppave commented Mar 26, 2023

   private func mergeAssetsAndPlay(assets: [Any]) {
        let videoURLs = assets.compactMap { $0 as? URL }
        let trackItems = videoURLs.map {
            let asset = AVAsset(url: $0)
            let resource = AVAssetTrackResource(asset: asset)
            let item = TrackItem(resource: resource)
            item.videoConfiguration.contentMode = .aspectFit
            return item
        }
        
        let timeline = Timeline()
        timeline.videoChannel = trackItems
        let compositionGenerator = CompositionGenerator(timeline: timeline)
        let composition = compositionGenerator.buildComposition()
        self.asset = composition
    }

See the issue with the above code.
How to set up correct orientation - the same I see f.e. in Photos app

@ppave ppave changed the title Landscape video is displayed downside Landscape video is displayed flipped over Mar 26, 2023
@ppave ppave changed the title Landscape video is displayed flipped over Some videos are rotated by 90 or 180 degrees for some reason Mar 26, 2023
@ppave ppave changed the title Some videos are rotated by 90 or 180 degrees for some reason Some videos are rotated by 90 or 180 degrees Mar 26, 2023
@ppave ppave changed the title Some videos are rotated by 90 or 180 degrees Orientation problem: some videos are rotated by 90 or 180 degrees Mar 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant