1

I am making an app that plays webm's that are located at an external network location (http://example.com/file.webm). Currently, I can play them using code like this:

String path = "http://example.com/file.webm";
WebView webView = (WebView)findViewById(R.id.web_view);
webView.loadUrl(path);

And it plays fine. However, I was wondering if there is a more elegant solution to this. Android supports .webm (VP8) video so are there any other internal API's that can handle this, giving me more control?

rds
  • 26,253
  • 19
  • 107
  • 134
nabir
  • 1,447
  • 2
  • 12
  • 17
  • Why did you tag this question html5 and webview? If you want an html5 file in a WebView, your solution is the shortest one (if short is a definiton of elegant) – rds Sep 15 '14 at 08:17
  • @rds .webm is a format for HTML5 video, however if this was a poor reason to tag is such I can remove it. – nabir Sep 15 '14 at 08:19

1 Answers1

0

A WebView is not optimal. Instead:

  • Use the VideoView element in your layout
  • or use a SurfaceView and a MediaPlayer that you control directly.

See also What are the difference between MediaPlayer and VideoView for Android

Community
  • 1
  • 1
rds
  • 26,253
  • 19
  • 107
  • 134