iOS5 中的 Youtube - 点击完成按钮 [英] Youtube in iOS5 - done button Tapped

查看:14
本文介绍了iOS5 中的 Youtube - 点击完成按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 iOS5 中我想加载 Youtube 电影,我做到了:

In iOS5 i want to load Youtube movies, and i done it with:

- (void)embedYouTube:(NSString *)urlString frame:(CGRect)frame {

NSString *embedHTML = @"
<html><head>
<style type="text/css">
body {
background-color: transparent;
color: white;
}
</style>
</head><body style="margin:0">
<embed id="yt" src="%@" type="application/x-shockwave-flash" 
width="%0.0f" height="%0.0f"></embed>
</body></html>";
NSString *html = [NSString stringWithFormat:embedHTML, urlString, frame.size.width, frame.size.height];
videoView = [[UIWebView alloc] initWithFrame:frame];
[videoView loadHTMLString:html baseURL:nil];
[self.view addSubview:videoView];

}

调用:

        [self embedYouTube:@"http://www.youtube.com/v/PqtUSSdf8b4" frame:CGRectMake(0, 0, self.view.frame.size.width, 100)];

我有带有完成"按钮的标准 Youtube 框架.当我点击完成按钮时,我重定向到我的根 VC.为什么?我怎样才能找到我的 VC(我打电话时的那个)?

And i have standard Youtube frame with "done" button. When i hit done button i'm redirect to my root VC. why? how can i get to my VC (the one when i'm calling it) ?

更重要的是 - 如何捕捉完成按钮"事件?

我有 MainVC 和 DetailVC.MainVC 调用 DetailVC 作为 ModalViewController.从那里我称之为 embedYouTube 方法.当我在这个屏幕上点击完成时:

I have MainVC and DetailVC. MainVC calls DetailVC as a ModalViewController. From there I call this embedYouTube method. When i'm hitting done on this screen:

我要回到 MainVC 而不是 DetailVC.为什么?如何捕捉这个事件?

i'm returning to MainVC not DetailVC. Why? How to catch this event?

而 iOS 6 只显示黑色背景——什么都没有.为什么?

And iOS 6 displays only black background - nothing. Why?

推荐答案

当你点击完成按钮时,全屏视频播放器将关闭,这被封装到全屏播放器中,系统自动作为该 youtube/flash 的一部分呈现Safari 嵌入技巧.使用它时,您不应该尝试做任何事情.

The fullscreen video player will dismiss when you tap the done button, this is encapsulated into that full screen player which the system automatically presents as part of this youtube/flash safari embed trick. You shouldn't try to do anything when this is used.

关于 iOS 6 - iOS 6 不再支持这种在您的应用程序中嵌入 YouTube 视频的方式 (来源)

About iOS 6 - iOS 6 no longer supports this way of embedding YouTube videos in your application (source)

从 iOS 6 开始,嵌入 YouTube URL 的形式为http://www.youtube.com/watch?v=oHg5SJYRHA0 将不再有效.这些URL 用于在 YouTube 网站上查看视频,而不是用于嵌入在网页中.相反,描述了应该使用的格式此处:https://developers.google.com/youtube/player_parameters.

As of iOS 6, embedded YouTube URLs in the form of http://www.youtube.com/watch?v=oHg5SJYRHA0 will no longer work. These URLs are for viewing the video on the YouTube site, not for embedding in web pages. Instead, the format that should be used is described here: https://developers.google.com/youtube/player_parameters.

这篇关于iOS5 中的 Youtube - 点击完成按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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