Expand to Fill Portrait YouTube Video?

Discussion in 'iOS Programming' started by ArtOfWarfare, Sep 29, 2011.

  1. ArtOfWarfare macrumors G3


    Nov 26, 2007
    I'd like to embed some help videos in my app to highlight how to use some of the features I'm not sure are being utilized by the users.

    I found instructions for how to nicely embed a YouTube video into your app here:

    The only issue is, I'd like to play the video full screen in portrait orientation.

    I imagine forcing it into portrait isn't too hard (it's just a matter of overriding the orientation rotation methods of the view controller, right?) But the issue is that all YouTube videos are either 16:9 or 4:3 orientation (or am I wrong?) To overcome that, I'll just make my video HD and center the video in the middle.

    This is where the real issue is: How do I make the video expand to fill the screen? IE: In the video playing interface, at the top of the screen there's the scrub bar in the middle, a done button on the left, and a button with two arrows on the right. I'd like it to be as if the button on the right were hit.

  2. xStep macrumors 68000

    Jan 28, 2003
    Less lost in L.A.
    Interesting problem. ;)

    As I understand it, the video orientation is kept when YT converts your video. Well, when it knows. So, no, the videos are not limited to 16:9 or 4:3. The web page playback player will adjust its playback window and place a portrait video in the horizontal middle of a pre-defined rectangle of the player software. I just see white on either side of a video.

    The YT player on the iOS device downloads the video as is, without side borders imposed because they are not added by YT encoding. So it will playback in full screen mode. I found a video online to test this with. Here it is.

    The two-arrows button you mention are the fill/non-fill screen option. I should think that if you make your video match the aspect ratio of the iPhone screen (16:10?), it may not appear. Yes, I'm somewhat guessing. The iPad has a different aspect ratio, so you may have considerations for that too.

    My problem with the YT player is that is starts in landscape, even though I'm holding my iPod in portrait orientation and the video is portrait. I have to twist my iPod to get the orientation right. The player is a little dumb.

    At some point, you have to have faith that your user has the experience and know how to playback video.

Share This Page