0

如何在 android 的 Webview 中播放 HTML5 视频?

4

1 回答 1

0

Embed the video tag as below in yoru WebView

<video id="video" autobuffer width="320" height="240">
  <source src="movie.mp4">
  <source src="movie.ogg">
Your browser does not support the video tag.
</video>

Set the event as below for click.

var video = document.getElementById('video');
video.addEventListener('click',function(){
  video.play();
},false);

Though using type="video/mp4" is accepted HTML5 standard, Andorid browsers seem to mess up with it. So don't use it.

于 2013-04-01T10:04:11.727 回答