简体   繁体   English

如何在phonegap中播放swf文件?

[英]How to play an swf file in phonegap?

I am developing a flash application in phonegap for android. 我正在开发一个用于android的phonegap的flash应用程序。

I have tried to embed the flash in html but of no luck. 我试图在html中嵌入flash,但没有运气。 Its showing blank and nothing comes up. 它显示空白,没有任何结果。

I then tried to use childBrowser, the childbrowser opens up but still a blank screen. 然后我尝试使用childBrowser,子浏览器打开但仍然是一个空白屏幕。

Can you please guide me how should I proceed so that i can play swf file. 你能指导我如何继续下去,以便我可以播放swf文件。 The swf is playing fine in the android browser but it doesn't play when I open up through childBrowser. swf在Android浏览器中播放正常,但是当我通过childBrowser打开时它不能播放。

Do you have any idea? 你有什么主意吗?

THanks in advance 提前致谢

The solution from Vigrond's answer does no longer work: as of Cordova 1.6 the PluginState symbol seems to be gone. 来自Vigrond答案的解决方案不再有效:从Cordova 1.6开始,PluginState符号似乎已经消失。 I did not investigate this further, but found the following solution to work: 我没有进一步调查,但发现以下解决方案:

super.init();
super.appView.getSettings().setPluginsEnabled(true);

I placed this inside my app's onCreate method. 我把它放在我的应用程序的onCreate方法中。

Originally found here . 最初在这里找到。

You may have to enable the Flash Plugin for the WebView that phonegap runs in. 您可能必须为运行phonegap的WebView启用Flash插件。

You'll have to download the PhoneGap source and recompile it using Eclipse or whatever java environment you'd use. 您必须下载PhoneGap源并使用Eclipse或您使用的任何Java环境重新编译它。

In DroidGap#onCreate add the lines to activate plugins: 在DroidGap#onCreate中添加激活插件的行:

   WebSettings settings = appView.getSettings();
   settings.setPluginState(PluginState.ON); // Turn Flash plugin on

Phonegap doesn't support this officially as Apple does not support Flash. 由于Apple不支持Flash,因此Phonegap不会正式支持此功能。 Furthermore it has been announced that Adobe is going for HTML5 in phones and not investing further into Flash on mobile. 此外,已宣布Adobe将在手机中使用HTML5,而不是在手机上进一步投入Flash。

Similar question here: flash plugin for phonegap 类似的问题在这里: flashgug为phonegap

Google Group topic: https://groups.google.com/forum/#!topic/phonegap/s3xZ8qxTL-M Google论坛主题: https//groups.google.com/forum/#! topic / phonegap / s3xZ8qxTL-M

I know this is an old post, but it helped me, and i fell the need to contribute. 我知道这是一个老帖子,但它帮助了我,而且我没有必要做出贡献。

Vigrond's answer no longer works, but it can give us a clue about what to do. Vigrond的答案不再适用,但它可以让我们知道该怎么做。

DroidGap is Deprecated DroidGap已弃用

/**
 * This used to be the class that should be extended by application
 * developers, but everything has been moved to CordovaActivity. So
 * you should extend CordovaActivity instead of DroidGap. This class
 * will be removed at a future time.
 *
 * @see CordovaActivity
 * @deprecated
 */

So, go to the CordovaActivity class and add Vigrond's snippet: 所以,转到CordovaActivity类并添加Vigrond的片段:

WebSettings settings = appView.getSettings();
settings.setPluginState(PluginState.ON); // Turn Flash plugin on

And add some imports: 并添加一些导入:

import android.webkit.WebSettings;
import android.webkit.WebSettings.PluginState;

This may do the trick for now. 这可能是现在的诀窍。

Best regards y'all. 最好的问候你们。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM