When you have a web view and the web view contains a video, then the video playback is controlled by web view instance. By default, the video playback support in-line and full screen.
in line video playback
full screen video playback
If you're still trying to support iOS6 or iOS7 at this moment, then you might face a problem related to the presenting ViewController's rotation status if your app supports more than one orientation.
- View controller A contains web view B
- Web view B displays a page with video inside
- User taps the video, and the video start to playback
- User taps the full screen button like
- User rotates the device in full screen
- User dismiss the video playback full screen
- User saw your presenting view controller A's layout is not updated
The solution is to get the notification when video playback exits full screen. So far, we have 3 solutions.
In iOS8, the video playback view controller will present the video on top of your current view hierarchy, but, before iOS8, the video playback is presented as a model view controller
Use undocumented notifications
@"UIMoviePlayerControllerDidExitFullscreenNotification" is an undocumented notification emitted by UIWebView, similar to
This works perfect because this notification is dropped in iOS8, but comes with a risk that it might get rejected!
I haven't tested this in my app.
Use window related notifications
UIWindowDidBecomeHiddenNotification are officially supported, but the thing is it will make your code more complicated, because the behaviour prior to iOS8 and from iOS8 are different.
I don't like this solution, but yes, you can, because Mobile Safari will propagate
video tag. To visit the detail, please take a look at this Stack Overflow page.