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.
精彩评论