I tried below code to convert video from ALAsset
to NSData
, this NSData
is submitting to the server correctly.
Problem:
But the problem is when I get the thumbnail from NSData in the server, the image is not oriented correctly for some videos and showing correctly for other videos. Also i feel that Video also not oriented correctly.
So do I have to include any thing extra in my code. I know how to orient Image but I don't know how to orient correctly a video.
-(NSData *)ConvertVideoToNSData:(ALAsset *)asset{
NSData *VideoData;
ALAssetRepresentation *rep = [asset defaultRepresentation];
Byte *buffer = (Byte*)malloc(rep.size);
NSUInteger buffered = [rep getBytes:buffer fromOffset:0.0 length:rep.size error:nil];
VideoData = [NSData dataWithBytesNoCopy:buffer length:buffered freeWhenDone:YES];
return VideoData;
}