开发者

android WebView stop Flash plugin onPause

I have a WebView that contains a html file that contains a Flash plugin (a video).

When the user presses play on the Flash plugin, the video plays fine.

However when the user closes the app or moves to a new Activity, the Flash is still playing in th开发者_JS百科e background. Going back to the view appears to create a new thread with the Flash plugin running on it.

How can we stop the Flash plugin running onPause?

Thanks


I ran into the same issue. The following worked for me:

@Override
protected void onDestroy() {
    super.onDestroy();
    final WebView webview = (WebView)findViewById(R.id.webPlayer);
    // Calling .clearView does not stop the flash player must load new data
    webview.loadData("", "text/html", "utf-8");
}


try this.

 public boolean onKeyDown(int keyCode, KeyEvent event) {
    if (keyCode == KeyEvent.KEYCODE_BACK && webview.canGoBack()) {
        webview.goBack();
       return true;
    }
    if (keyCode == KeyEvent.KEYCODE_BACK) {
        //webview=null;
        webview.reload();
    }
    return super.onKeyDown(keyCode, event);
   }  

Pavan

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜