I am trying to upload images and videos to server. it working fine. the problem I am facing is the picture captured or video recorded from the iphone having too much size and it takes time to upload to server. how can i reduce the size of video data ?
if(asset.mediaType == .video)
{
var dataMOV : Data?
manager.requestAVAsset(forVideo: asset, options: option2, resultHandler: {(asset: AVAsset?, audioMix: AVAudioMix?, info: [AnyHashable : Any]?) in
let avURLAsset = asset as? AVURLAsset
do
{
let data = try Data(contentsOf: (avURLAsset?.url)!)
dataMOV = data
print("asset data :%@ ", data)
}
catch
{
}
})
}
From AssetInfo, pull the asset URL and pass it to below method