视频未在android webview中播放
我正在将资产文件夹中的html页面加载到android webview,html页面包含视频。但是视频没有播放,我在这里分享代码视频未在android webview中播放,android,android-webview,Android,Android Webview,我正在将资产文件夹中的html页面加载到android webview,html页面包含视频。但是视频没有播放,我在这里分享代码 <!doctype html> <head> <title></title> <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"> <script type="text/javasc
<!doctype html>
<head>
<title></title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<script type="text/javascript" charset="utf-8" src="video.js"></script>
<script>
function en(){
video1.play();
}
</script>
</head>
<body>
<div id="t2" width ="1024" height="768" style="background- image:url(images/L6_P007.jpg); background-repeat:no-repeat;">
<video id="video1" width="1024" height="768" poster="images/L6_P007.jpg" controls autoplay onended="en();" >
<source src="videos/L6_P007.mp4" type="video/mp4">
<source src="videos/L6_P007.ogv" type="video/ogg">
<source src="videos/L6_P007.webm" type="video/webm">
</video>
</div>
</body>
</html>
这个问题已经讨论过很多次了。检查类似问题的答案 得到 视频播放器允许您显示PhoneGap应用程序中的视频 此命令激发让设备视频播放器显示视频的意图 将插件添加到项目中 使用此插件需要Android PhoneGap 要安装插件,请将www/video移动到项目的www文件夹中,并在phonegap.js之后的html文件中包含对它的引用 在项目中创建一个名为“src/com/phonegap/plugins/video”的目录,并将VideoPlayer.java移到其中 在
res/xml/plugins.xml文件中添加以下行:
<plugin name="VideoPlayer" value="com.phonegap.plugins.video.VideoPlayer"/>
注意:从assets文件夹播放视频时,视频首先以可读模式复制到内部存储器。我编辑了我的问题,你能分享一下如何使用插件在android webview中加载html页面吗?完成了,如果我的回答有帮助,那么别忘了升级/接受iti我必须在android webview中加载html页面,不在vidoe视图中请检查我提供的链接,android webview不支持html5的视频标记,这就是我们需要使用此库的原因。@Deepa您找到解决方案了吗。如果是,请与我分享。提前谢谢。
<plugin name="VideoPlayer" value="com.phonegap.plugins.video.VideoPlayer"/>
window.plugins.videoPlayer.play("http://path.to.my/video.mp4");
window.plugins.videoPlayer.play("file:///path/to/my/video.mp4");
window.plugins.videoPlayer.play("file:///android_asset/www/path/to/my/video.mp4");
window.plugins.videoPlayer.play("https://www.youtube.com/watch?v=en_sVVjWFKk");