Play youtube video in full screen?

陌路散爱 提交于 2019-12-11 06:29:59

问题


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

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

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.

Thanks,

Madhup


回答1:


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

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.



来源:https://stackoverflow.com/questions/2627536/play-youtube-video-in-full-screen

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