0
我正在使用輸入標記和type =「file」屬性來獲取他的視頻文件並使用調用播放視頻的函數的java腳本。我用我的PC在Chrome上工作,但不能在移動設備上播放(android手機和ipad)。以下是我的代碼。我堅持這一點,非常感謝任何幫助。HTML5視頻標記在移動設備中不起作用
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<h1> Welcome</h1>
<h2> Step1.record a video</h2>
<form action="{{ upload_url }}" method="POST" enctype="multipart/form-data">
Click this button to start recording, Don't worry you can preview befor uploadiong the video:
<input id="uploadImage" type="file" name="video" accept="video/*" onchange="PreviewImage();" capture ><br><br>
<input type="submit" name="submit" value="Submit">
</form>
<video id="uploadPreview" style="width: 800px; height: 600px;" controls/>
<!--<source src="" type="video/mp4">-->
<!--<source src="" type="video/ogg">-->
<!--<source src="" type="video/webm">-->
</video>
</body>
<br />
<script type="text/javascript">
function PreviewImage() {
var oFReader = new FileReader();
oFReader.readAsDataURL(document.getElementById("uploadImage").files[0]);
oFReader.onload = function (oFREvent) {
var video = document.getElementById("uploadPreview");
video.src = oFREvent.target.result;
video.play();
};
};
</script>
</body>
</html>