如何在iOS中播放Vimeo视频? [英] How to play a Vimeo video in iOS?

查看:198
本文介绍了如何在iOS中播放Vimeo视频?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图搜索网络,但是我找不到关于这个问题不超过1年的主题,因此;

I've tried to search to web, but I couldn't find a topic not older than 1 year regarding this problem, therefore;

我怎么玩iOS应用中的Vimeo视频?

How can I play a Vimeo video in an iOS App?

EDIT1:使用解决方案我有时会从Vimeo获得此HTTP响应

When using the solution I'm sometimes getting this HTTP response from Vimeo

为什么?

推荐答案

这是我在应用程序中播放Vimeo视频的方式。

This is my way of play a Vimeo video inside a app.

我正在使用iFrame在我的应用程序中加载Vimeo视频。

I am using iFrame to load Vimeo video inside my app.

按照以下步骤进行操作。

follow this steps and you will too.

创建一个uiwebview并将其连接到.h文件。我是_webView。

create a uiwebview and connect it to your .h file. Mine is _webView.

将此方法添加到.m文件中。

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];
}

我在Vimeo视频中使用嵌入式代码。 (我希望你知道它是什么)

I am using the embedded code in Vimeo video. (I hope you know what it is)

在你的viewdidload中调用这个方法

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.

这篇关于如何在iOS中播放Vimeo视频?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆