I tried under the code to convert the video from ALAssetto NSData, this one is NSDatasent to the server correctly.
Problem:
But the problem is that when I get a sketch from NSData on the server, the image is not correctly oriented for some videos and correctly displays other videos. I also think that the video is also not oriented correctly.
So I have to include in the code all something extra. I know how to orient the image, but I do not know how to properly orient the 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;
}
source
share