html5 video 标签中 支持 m3u8 直播
<video id="camera1" src="http://10.10.2.167/t00000000000086/t00000000000086.m3u8" poster="/static/img/photo-run.jpeg" preload="none" ></video>
当网页在ios平台展示时,第一次点击正常播放,第二次点击就无法播放需要刷新页面。 具体机制还没搞明白。 使用了比较土的方法实现了每次点击都能实时播放
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>JW Player for Flash</title>
<style type="text/css">
body { background-color: #fff; padding: 0 20px; color:#000; font: 13px/18px Arial, sans-serif; }
a { color: #360; }
h3 { padding-top: 20px; }
ol { margin:5px 0 15px 16px; padding:0; list-style-type:square; }
</style>
<script type="text/javascript">
function play()
{
var myDate = new Date();
var millseconds=myDate.getMilliseconds();
var videoWrapper=document.getElementById("videowrapper");
var videotag="<video id=\""+millseconds+"\" src=\"http://10.10.2.167/t00000000000086/t00000000000086.m3u8\"></video>";
videoWrapper.innerHTML=videotag;
videoWrapper.style.display="hidden";
var Media = document.getElementById(millseconds);
Media.src="http://10.10.2.167/t00000000000086/t00000000000086.m3u8?time="+myDate.getMilliseconds();
//alert(Media.src);
Media.load();
Media.play();
}
</script>
</head>
<body>
<br>
<div style="visibility:hidden;" id="videowrapper"></div>
<a href="#" οnclick="play();"><h1>play</h1></a>
</body>
</html>