Play youtube full screen on landscape, but inline on portrait - on iPhone - iphone

I have a view with a UIWebView on half the size of the iPhone screen.
In this webview I embed youtube videos.
The app is only in portrait mode. Though I would like to see videos play also in landscape.
Now I want the following behaviour:
When in portrait, play inline, don't go full screen.
a. For that I use "webView.allowsInlineMediaPlayback=YES;"
b. I open the webview with this link: "www.youtube.com/embed/videoid?playsinline=1"
If the user rotates the screen to landscape, I'd like the video to go full screen.
If the user then rotates back to portrait, I'd like the video to get inline again.
The rotations shouldn't stop the video in the middle, or restart the play.
What should I do?

As the embedded videos use an undocumented MPInlineVideo(Fullscreen)ViewController, you can't use its API and switch to fullscreen.
I'd thus recommend playing around with the "allowFullScreen"-parameter for the iframe-tag.
If everything fails, you should always be able to change the frame-size of the web-view so that it covers the full screen. You'd have to use width/height 100% in the iframe then.
Disclaimer: This is an educated guess. I've not actually tried to implement it that way.

Related

UIWebView Rotation

I am using a UIWebView in my app and when I rotate my iPhone the webview rotates along with it, works just fine. However, you see the corners of the background view behind my webview as it rotates and it can look a little flickery when rotating.
So I went and tried Safari on my iPhone, using the same website and it different. In Safari if I rotate, its far smoother, I can also see it zooms slightly.
For example, I am on Apple's homepage in portrait mode, fully zoomed out to see the whole page. I rotate to landscape and the contents zooms, as far as I can observe this is why it looks smoother.
So, my question, how can I achieve this in my app?
I have played with the 'Scales Page To Fit' option but had no success.
Currently:
Rotating scales the webpage to fit the view. (Whole page is zoomed out to be seen).
Required:
When rotating, rather than rescaling the page, just let it zoom as required.
Don't know if this will help you, but you might find it useful to change the background color (or even background image) of the view behind your webview, which might mitigate your issue with seeing the corners.
If you haven't found a solution yet... As an alternative you could try refreshing the webview, if you notice that the device has rotated, refresh webview and webkit should renderize it again, also play with the HTML meta viewport tag (initial zoom, scale, etc.) and CSS media queries to support different scales. As for the HTML document, try using em, and pt units in CSS rules.
//reload webview
[self.webView reload];
link Orientation Notifications
hope this help in something

size mismatch while rotation ipad/iphone webview for youtube

I am working on YouTube Video playing application where i need to play videos through UIWebView its working fine when i m rotating the devices from portrait to landscape mode.But When i click The Zoom option(Zoom Option means through UIWebView) and trying to rotate the Screen from portrait to landscape mode its showing white Blank screen in bottom right corner.and in case of landscape to portrait at bottom part its showing white blank screen.please help me out.
I guess it has something do with your webviews background color. Anyway can you provide some screenshots to make it more clear.

UIImagePicker force photo in portrait mode (disable accelerometer)

I'm building an application which takes photos using the UIImagePickerController. Works great.
The problem however is that I don't want to use image rotation. I always want a photo in portrait mode just as the user sees it on the screen.
When you take your iPhone on the side and then slowly take it back to normal the orientationmode isn't updated. Now when you take the photo the orientation flags in the EXIF data are set.
Is there a way to get rid of orientation support in de imagepicker? Could I just disable the accelerometer?

MPMoviePlayerController Fullscreen mode doesn't actually display over the entire screen

I've implemented video play functionality within my app, and everything is working perfectly, except for this one issue. Whenever the fullscreen toggle button is tapped, or if you double-tap the screen, this of course is meant to toggle the video from being played in it's natural wide screen state (black is seen above and below the video) to a zoomed state, where the video takes up the entire screen of 480x320. For me, the video adjusts slightly in size, but doesn't come close to taking up the entire screen. This works correctly in almost every app I can think of that plays videos, such as Fandango, YouTube, etc.
In this zoomed mode, of course you're losing part of the picture, because it's actually off the screen, since the only way to render a 2.40:1 image on the full screen while still maintaining aspect ratio is to zoom. Again, every other app I can think of works this way, but it's not working for me.
So, I have tried everything I can think of to get this full screen zoomed feature to work, but no luck.
Any ideas?
After some testing, it appears that this is due to the format/encoding of the video itself. I don't know specficis, however. I just know that depending on which video is being played, this feature may or may not work.

Embedded youtube video not playing in landscape on iPhone

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 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.