开发者

Embedded youtube video not playing in landscape on iPhone

开发者 https://www.devze.com 2023-01-31 06:27 出处:网络
I\'m trying to embed a youtube video in my app. It works fine but starts in portrait and will not rotate to landscape (making the video kind of small).

I'm trying to embed a youtube video in my app. It works fine but starts in portrait and will not rotate to landscape (making the video kind of small).

I开发者_StackOverflow社区'm doing all this in a UIWebView with the size of 237x353 The containing viewcontroller should only work in portrait (does this affect the issue). I've read that embedded youtube videos automagically starts in a MPMoviePlayerController so I'm guessing it can control orientation on it's own?

Any clues on why it will not start in landscape?


Never mind. I figured the problem lies in using the <iframe> tag suggested by YouTube. This always made my video show in portrait. If your underlying viewcontroller only supports portrait that's what you going to get. You are better off using:

<embed id="yt" src="http://www.youtube.com/watch?v=ZflCTKggPAQ" type="application/x-shockwave-flash" width="237" height="250"></embed>

Also what made this even harder to debug is the fact that the above code will not work in simulator whereas the <iframe> does. With the above code and device all is golden.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号