Reputation: 11338
I want to play video in UIWebView. This video is stored in my app (It is local video not coming from server).
I dont want to use MPMoviePlayerController
.
I got the following code from SO :
NSString *url = @"http://my_url.com/my_movie_path/";
UIWebView* tempAudioPlayer = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, 0, 0)];
[tempAudioPlayer loadHTMLString:[NSString stringWithFormat:@"<iframe frameborder=\"0\" width=\"0\" height=\"0\" src=\"%@\"></iframe>", url] baseURL:nil];
[self addSubview:tempAudioPlayer];
But Its not working for me.
Is there any other method to play video without MPMoviePlayerController
?
What should I do ?
Upvotes: 1
Views: 5058
Reputation: 9866
You can try below link if it works....
http://apiblog.youtube.com/2009/02/youtube-apis-iphone-cool-mobile-apps.html
This will guide you how to play videos from local storage..
Try to attach video in HTML string with local path as URL... (only hint) i have not tried but will be good reference to try.... use other (dh14-sl's) strong text answer also as reference to create HTML string
Upvotes: 0
Reputation: 2529
NSString *Str = @"<video controls> <source src=\"yourvideofile.mp4\"> </video>";
NSString *path = [[NSBundle mainBundle] pathForResource:@"yourvideofile" ofType:@"mp4"];
[Webview loadHTMLString:Str baseURL:[NSURL fileURLWithPath:path]];
Upvotes: 9