Swift: Crop and Export Video

后端 未结 1 1317
北荒
北荒 2020-12-16 18:49

I want to crop a video to square, but i couldn\'t do that.

I converted this code to swift but i only get black screen after exporting the video

             


        
相关标签:
1条回答
  • 2020-12-16 19:18

    You're missing the exporter block at the very end to perform the export operation with the AVAssetExportSession you've created:

    exporter.exportAsynchronouslyWithCompletionHandler({
    
        //display video after export is complete, for example...
        let outputURL:NSURL = exporter.outputURL;
        let asset:AVURLAsset = AVURLAsset(URL: outputURL, options: nil)
        let newPlayerItem:AVPlayerItem = AVPlayerItem(asset: asset)
    
        self.mPlayer = AVPlayer.playerWithPlayerItem(newPlayerItem) as AVPlayer
    
    })
    
    0 讨论(0)
提交回复
热议问题