如何在WebView中播放SWF文件?

时间:2019-05-30 07:43:58

标签: android flash webview

我正在尝试使用swf运行WebView文件。 但未显示。我还在电话上安装了AdobeAirFlashPlayer

webView=(WebView)findViewById(R.id.webview);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setPluginState(WebSettings.PluginState.ON);
webView.loadUrl("http://condor.depaul.edu/sjost/hci430/flash-examples/swf/bumble-bee1.swf");

清单:

<uses-permission android:name="android.permission.INTERNET"/>

<application android:hardwareAccelerated="true"
</application>

我了解Android不支持swf文件,也不支持Adobe。 有什么方法可以在Android上显示swf文件? 因此,有swf个播放器在Google Play上运行,他们是如何做到的?

1 个答案:

答案 0 :(得分:0)

我尝试使用geckoview_library,但在实施时遇到错误。

apply plugin: 'com.android.application'

android {
compileSdkVersion 19
buildToolsVersion "28.0.3"

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
    applicationId "com.example.data"
    minSdkVersion 8
    targetSdkVersion 18
}

flavorDimensions "abi"

productFlavors {
    x86     { dimension "abi" }
    x86_64  { dimension "abi" }
    arm     { dimension "abi" }
    aarch64 { dimension "abi" }
}

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
    }
}
}


dependencies {
implementation 'com.android.support:support-v4:19.1.0'
x86Implementation     "org.mozilla.geckoview:geckoview-nightly-x86:64.0.20180927100037"
x86_64Implementation  "org.mozilla.geckoview:geckoview-nightly-x86_64:64.0.20180927100037"
armImplementation     "org.mozilla.geckoview:geckoview-nightly-armeabi-v7a:64.0.20180927100037"
aarch64Implementation "org.mozilla.geckoview:geckoview-nightly-arm64-v8a:64.0.20180927100037"

 }

渐变项目:

buildscript {
repositories {

    jcenter()
    google()
    maven {
        url "https://maven.mozilla.org/maven2/"
    }
    maven {
        url 'https://ci.mozilla.org/job/mozilla-central-geckoview/mozilla-central_Maven_Repository'
    }
}
dependencies {
    classpath 'com.android.tools.build:gradle:3.3.2'
}
}