Play video in UIWebView from NSData
Posted
by Papagalli
on Stack Overflow
See other posts from Stack Overflow
or by Papagalli
Published on 2010-06-17T09:49:49Z
Indexed on
2010/06/17
9:53 UTC
Read the original article
Hit count: 620
Hello there,
Does anybody know how to play a video in a UIVebView ?
The video comes from the iphone library, when I pick it, I store it in core data as binary data.
If i use the local url of the video it's working fine, the problem I have is that the this url refers to a folder named "tmp", and I don't know the lifetime of it. If I can get the real url of the video file it will be ok.
//attachment is the core data object containing the data
NSURL *url = [NSURL URLWithString:attachment.path];
[self.webView loadRequest:[NSURLRequest requestWithURL:url]];
I tried a solution that doesn't work: (i tried MIMETypes : "video/quicktime" and "video/mp4")
[self.webView loadData:attachment.data MIMEType:@"video/mov" textEncodingName:nil baseURL:nil];
I think the second solution is the closest, and the problem comes from the MIMEType.
Thanks by advance if anybody has a solution for this :)
© Stack Overflow or respective owner