I figure it out!!!!! In the NSData I cannot assign the a content as a File straightaway. First the video path must be declared, like a video player. For Example:
NSString *path = [[NSBundle mainBundle] pathForResource:@"trailer_iphone" ofType:@"m4v"];
Than we declare the NSData referencing the previous path like this:
NSData *data = [[NSData dataWithContentsOfFile:path]
To finalize we just need to set the iOS7 base64 encode support:
NSData *data = [[NSData dataWithContentsOfFile:path]base64EncodedDataWithOptions:NSDataBase64Encoding64CharacterLineLength];
That's it!!! Totally encoded!!!
If you wish to break your code in small chunks just see this link!
My final method is this one:
-(void)videoBreak{ NSString *url = [[NSBundle mainBundle] pathForResource:@"trailer_iphone" ofType:@"m4v"]; NSData *data = [[NSData dataWithContentsOfFile:url]base64EncodedDataWithOptions:NSDataBase64Encoding64CharacterLineLength]; NSUInteger length = [data length]; NSLog(@"First log %@ length = %i",data,length); NSUInteger chunkSize = 4 * 1024; NSUInteger offset = 0; do { NSUInteger thisChunkSize = length - offset > chunkSize ? chunkSize : length - offset; NSData* chunk = [NSData dataWithBytesNoCopy:(char *)[data bytes] + offset length:thisChunkSize freeWhenDone:NO]; offset += thisChunkSize; // do something with chunk NSLog(@"chunk = %@ \"n\"offset = %i \"n\"thisChunkSize = %i \"n\"lenght = %i",chunk, offset,thisChunkSize, length); } while (offset < length); }