Vimeo videos in iPhone app
I was wondering if there's a way to "embed" a Vimeo video in an iPhone app.
For YouTube videos I'm using a webview containing the correct embed code for the YouTube video and the iPhone's native YouTube support will then transform the flash player into a YouTube button.
Is there a similar way to play Vimeo videos from m开发者_如何学Pythony app?
Maybe someone knows the correct <video>
-src for Vimeo videos?
thanks, Thomas
This is the code to embed the vimeo video in a UIWebview
<iframe src='http://player.vimeo.com/video/12345678?title=0&byline=0&portrait=0' width='320' height='480' frameborder='0'></iframe>
here 12345678 is the video id.
Sadly my app got rejected for embedding HQ vimeos in a UIWebview in the app.
It appears that vimeo is transcoding all videos being uploaded these days into versions compatible for the iphone which are used on their site when you browse from an iphone or ipad. You can however call their videos into an HTML5 player on your site by doing some simple tricks found here. If you can host a page on your site somewhere, you can load the video into a UIWebView and it should all work. Vimeo's only limitation is that there embed code is flash but the video infrastructure is all there for HTML5. Hope this helps!
I'm not sure if this is possible - Vimeo uses flash.
However according to this
http://news.cnet.com/8301-27076_3-10394769-248.html
Some videos in the Vimeo collection have been converted to be playable on mobile devices that don't support flash
According to Vimeo forum at the moment the only way is to link to a mobile URL like
vimeo.com/m/#/id
they say they will add API to search mobile video content more info on http://vimeo.com/forums/topic:20132
NSString *htmlString = [NSString stringWithFormat:@"<html>"
@"<head>"
@"<meta name = \"viewport\" content =\"initial-scale = 1.0, user-scalable = no, width = 320\"/></head>"
@"<frameset border=\"0\">"
@"<frame src=\"http://player.vimeo.com/video/%@?title=0&byline=0&portrait=1&autoplay=1\" width=\"320\" height=\"140\" frameborder=\"0\"></frame>"
@"</frameset>"
@"</html>",
videoID];
This is my way of play a Vimeo video inside a app.
I am using iFrame to load Vimeo video inside my app.
follow this steps and you will too.
create a uiwebview and connect it to your .h file. Mine is _webView.
Add this method to your .m file.
-(void)embedVimeo{
NSString *embedHTML = @"<iframe width=\"300\" height=\"250\" src=\"http://www.vimeo.com/embed/rOPI5LDo7mg\" frameborder=\"0\" allowfullscreen></iframe>";
NSString *html = [NSString stringWithFormat:embedHTML];
[_webView loadHTMLString:html baseURL:nil];
[self.view addSubview:_webView];
}
I am using the embedded code in Vimeo video. (I hope you know what it is)
call this method inside your viewdidload
[self embedVimeo];
Run the app and you will see the video in your view. This way is perfectly working for me and i think this will help for your too.
精彩评论