views:

401

answers:

0

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 :)