Question

I have a .mp4 video url in my server and trying to play by using the following code. But it doesn't do any actions when click on play button. I'm trying to test on iPhone 4.0 simulator or iPod 4.1 device. Is there anything wrong here (or) can't it work on iOS 4.0 or 4.1?

NSURL *url = [NSURL fileURLWithPath:encodedURL];
MPMoviePlayerController *videoPlayer = [[MPMoviePlayerController alloc]initWithContentURL:url];
[self.view addSubview:videoPlayer.view];
videoPlayer.view.frame = CGRectMake(0, 0, 320, 480);
[videoPlayer play];

Please advise!

Encode function:

NSString *newString = [(NSString *)CFURLCreateStringByAddingPercentEscapes(kCFAllocatorDefault, (CFStringRef)string, NULL, CFSTR("?#[]@!$ &'()*+,;=\"<>%{}|^~`"), CFStringConvertNSStringEncodingToEncoding(NSUTF8StringEncoding)) autorelease];

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top