[英]HTML5 Video for mobile
I'm having some issues with video for mobile and HTML5.我在移动视频和 HTML5 方面遇到了一些问题。 My biggest problem is that the video will play like 2 seconds and stop because not enough of the video has loaded.
我最大的问题是视频将播放 2 秒并停止,因为没有加载足够的视频。 The video is 1:26s long and 9mb.
视频长 1 分 26 秒,大小为 9mb。 I was testing on wifi.
我在wifi上测试。 Is there a way that I can make the video wait til enough has loaded so it can play without issues?
有没有办法让视频等到足够多的加载后才能正常播放? or what is my best option to help solve this?
或者我最好的选择是什么来帮助解决这个问题?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1 /DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
<script type="text/javascript">
</script>
<style type="text/css">
<!--
body {
margin: 0px;
padding: 0px;
background-color:#000;
}
-->
</style>
</head>
<body>
<!--<div id = "m_loader">
<div id = "loading_hold">
<img src="d_logo.png" width="365" height="500" />
</div>
</div>-->
<video controls="controls" autoplay="autoplay">
<source src="reel720_3.mp4" type="video/mp4" />
<source src="reel720_3.webm" type="video/webm" />
Your browser does not support the video tag.
</video>
</body>
You can use the "canplaythrough" event.您可以使用“canplaythrough”事件。 Though you may want to show some sort of progress/download indicator while this is happening.
尽管您可能希望在发生这种情况时显示某种进度/下载指示器。
myVideo.addEventListener('canplaythrough', function() {
myVideo.play();
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.