Air for Android: video loaded inside StageWebView crashes on fullscreen after device orientation changes-Collection of common programming errors
I have a simple application, which tries to load an mp4 video inside a StageWebView, and display it inside an AIR application for Android. For the sake of examples, I simplified everything down to this:
AIR code
public function videoTest() {
addEventListener(Event.ADDED_TO_STAGE, onAdded);
}
public function onAdded(ev:Event):void {
webView = new StageWebView();
webView.stage = stage;
webView.viewPort = new Rectangle(0, 0, stage.fullScreenWidth, stage.fullScreenHeight);
webView.loadURL("http://jsfiddle.net/at386/show/");
}
and the fiddle code is this
After starting the application on my phone, (Galaxy s2), in portrait mode, the StageWebView loads fine, the video player is displayed, I can start the video, I can even go on fullscreen mode. If I turn the phone on landscape, i get the following behavior:
- fullscreen mode exits
- video displayed inside StageWebView is paused
clicking play and fullscreen again in landscape causes the application to crash after about 1-2 seconds (the sound from the video runs in the background), with an error message of
"Unfortunately, has crashed"
Any idea how to fix it?