ios平台上 hls直播 第二次点击无法播放

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>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值