I'm having an issue when I try to encode a video in base64 within iOS 7.
I am not sure if my NSdata is being set correctly.
The video is playing on my iOS simulator, it's fine though. However when the code reaches the NSData block it is doing nothing and my logs for data and base64String are returning null.
Please check my code out
//Try to encode Video //Path of the video NSString *url = [[NSBundle mainBundle] pathForResource:@"trailer_iphone" ofType:@"m4v"]; //startthe player player = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:url]]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(movieFinishCallBack) name:MPMoviePlayerPlaybackDidFinishNotification object:player]; //set the frame player.view.frame = CGRectMake(10,10,300,300); [self.view addSubview:player.view]; //start to play [player play]; NSData *data = [[NSData dataWithContentsOfFile:@"trailer_iphone.m4v" ]base64EncodedDataWithOptions:NSDataBase64Encoding64CharacterLineLength]; NSString *base64String = [data base64EncodedStringWithOptions:2]; NSLog(@"data = %@ base64String = %@",data, base64String);
Many Thanks!