全屏播放youtube视频? [英] Play youtube video in full screen?

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

问题描述

首先对不起,如果有人发现这个问题重复了(我自己没找到)。

First of all sorry, If somebody finds this question is repeated (haven't found any by myself).

我正在为iPad应用程序开发并尝试使用以下代码播放youtube视频:

I am developing for an iPad application and trying to play youtube videos using this code:

        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, youTubeUrl, 142.0, 129.5];
        [wbView loadHTMLString:html baseURL:nil];

代码在iphone应用程序中使用时工作正常(即你触摸webview并开始播放全屏的YouTube视频。)但是当在iPad上使用时,点击网页视图时,它会开始在网页视图中播放视频并显示全屏显示选项,同时我想从全屏开始播放一开始,就像在iPhone中一样。

The code works fine when used in an iphone application (i.e. you touch on the webview and it starts playing the youtube video in fullscreen.) But when used in the iPad, on clicking the web view it starts playing the video in the web view itself and shows options to go to full screen, while I want to start the playback in the full screen from the beginning, like it does in the iPhone.

任何有想法的人或之前做过的人都请帮忙。

Anybody having some ideas or people who have done it before please help.

谢谢,

Madhup

推荐答案

我有一个解决方案,但这只是一个解决方法。希望任何人都能提供更好的解决方案。

I got a solution to this but thats just a workaround only. Hopefully anybody gives a better solution.

我所做的是在网页浏览中添加了相同大小的按钮,当它触及时我用相同的html打开一个不同的webview并传递以编程方式在此Web视图上触摸事件。所以它对我来说就像我想要的那样。

What I did is I added buttons of same size on the webviews and when its touched I open a different webview with the same html and pass a touch event on this web view programmatically. So it works for me like I wanted.

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

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