开发者

Flash inside Android WebView — How do I set fullscreen automatically?

开发者 https://www.devze.com 2023-02-25 05:24 出处:网络
I am loading Flash SWFs into an Android WebView. I want the SWF to be instantly fullscreen and focused.

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 开发者_C百科(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>


Every Android App By Adobe uses a file "application.xml" -- by default as its Descriptor:

Take a look at that file before you write any code for this. It changes every revision, but the last time I used it was to set this variable (Full_screen)..

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号