Flash in Android WebView - How to automatically set the full screen?

advertisements

I am loading Flash SWFs into an Android WebView.

I want the SWF to be instantly fullscreen and focused.

The class name that handles flash is com.adobe.flashplayer.FlashPaintSurface. Watching the log, when I fullscreen the flash manually, it calls com.adobe.flashplayer.FlashPaintSurface.toggleFullScreen().

The first part of my question is: How can I call that method manually for my Flash SWF?

Note that with a webview with a flash embedded, the only way I seem to be able to fullscreen it properly (to have Flash's surfaceview fullscreen instead of the flash being displayed over top of the webview view) is by touching the screen with two fingers until an interface pops up at the top of the screen, and doesn't happen reliably.

For focus, inside my webview class I call:

@Override
protected boolean drawChild (Canvas canvas, View child, long drawingTime) {

    if (child.getClass().getName().equals("com.adobe.flashplayer.FlashPaintSurface")) {
        child.requestFocus();
    }
    return super.drawChild(canvas, child, drawingTime);
}

This doesn't set the focus as I thought it would. Although I assume, if fullscreened properly, the FlashPaintSurface should give itself focus. But if the first part is not doable, I would wonder at least to not have to give focus to the SWF by clicking on it on startup.

Please note I am doing this dynamically, not calling my own SWFs that I make myself, so I cannot solve this with Actionscript.


I have had success this using the code on my previous solution to Problem to load flv video in webview. It may be of some help.

The embed tag looks like this:

<embed
 style="width:100%; height:100%"
 src="./FLVPlayer.swf?fullscreen=true&video=./expression_sad.flv"
 autoplay="true"
 quality="high"
 bgcolor="#000000"
 name="VideoPlayer"
 align="middle"
 allowScriptAccess="*"
 allowFullScreen="true"
 type="application/x-shockwave-flash"
 pluginspage="http://www.macromedia.com/go/getflashplayer">
 </embed>