开发者

Play mp4 Video using <Embed> tag on Android Webview

I want to play mp4 video using tag on Webview. I have few constraints for not to use HTML5 tag. I have looked code to play YouTube video on webview. But YouTube uses .flv format. I have .mp4 开发者_Python百科video to play.

Thanks in advance.


You could play the video directly, without a WebView:

VideoView videoView = new VideoView(this);
setContentView(videoView);

Bundle extra = getIntent().getExtras();
if (null != extra && extra.containsKey("url")) {
    String url = extra.getString("url");
    Uri uri = Uri.parse(url);
    MediaController mc = new MediaController(this);
    videoView.setMediaController(mc);

    videoView.setVideoURI(uri);
    videoView.start();
}
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜