开发者

How to play media files (3GP/swf files) locally inside webview

Iam looking for playing media files inside webview Can you please help me out开发者_如何转开发 ..what iam missing..I loaded webview as : _webview.loadUrl("file:///android_asset/3gp.html"); and the code inside my html file is as:

<body>
<object width="550" height="400">
<param name="movie" value="sample.3gp">
<embed src="file:///android_asset/sample.3gp" width="550" height="400">
</embed>
</object>
</body>.

Iam not getting the output. Please hellp me out ..Thanks in advance


To play SWF files you have to enable plugins:

_webview.getSettings().setPluginState(PluginState.ON);

and if your .html file uses javascript:

_webview.getSettings().setJavaScriptEnabled(true);

EDIT to answer comment

In your situation you need to use your own webview at the moment links are redirecting to the browser:

 _webview.setWebViewClient(new DownloadWebViewClient());

 public class DownloadWebViewClient extends WebViewClient{

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
                return false; // Allows your webview to handle clicked links                
    }
 }
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜