问题描述
- 关于webview加载html文件,vedio.play()方法无效问题
- html文件代码如下:
<!DOCTYPE html>function load() {var myvideo = document.getElementById(""myvideo"");myvideo.style.width = document.body.clientWidth + ""px"";myvideo.style.height = document.body.clientHeight + ""px"";launchFullScreen(myvideo);var url= window.vedio.getUrl();replace(myvideourl);myVid = document.getElementById(""myvideo"");myVid.addEventListener(""timeupdate"" function () {if (myVid.ended) {window.vedio.finish();}});}function play() {var myvideo = document.getElementById(""myvideo"");alert(""播放视频"");myvideo.play();}function replace(objurl) {obj.setAttribute(""src"" url);}function launchFullScreen(element) {if (element.requestFullscreen) {element.requestFullscreen();} else if (element.mozRequestFullScreen) {element.mozRequestFullScreen(); q} else if (element.webkitRequestFullscreen) {element.webkitRequestFullscreen();} else if (element.msRequestFullscreen) {element.msRequestFullscreen();}}* {padding: 0;margin: 0;}html body #myvideo {width: 100%;height: 100%;}
其中 方法
function play() {
var myvideo = document.getElementById(""myvideo"");
alert(""播放视频"");
myvideo.play();
}
是在Java代码中调用,该方法已执行,但播放器尚未播放,跪求大神指点.ps:需要实现应用进入webview所在页面,视频自动播放