Vimeo videos in iPhone app

大兔子大兔子 提交于 2019-12-20 09:25:42

问题


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 my app?

Maybe someone knows the correct <video>-src for Vimeo videos?

thanks, Thomas


回答1:


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!




回答2:


This is the code to embed the vimeo video in a UIWebview

<iframe src='http://player.vimeo.com/video/12345678?title=0&amp;byline=0&amp;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.




回答3:


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




回答4:


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




回答5:


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&amp;byline=0&amp;portrait=1&amp;autoplay=1\" width=\"320\" height=\"140\" frameborder=\"0\"></frame>"
                                @"</frameset>"
                                @"</html>", 
                                videoID];



回答6:


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.



来源:https://stackoverflow.com/questions/2503235/vimeo-videos-in-iphone-app

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!