我们使用PHP脚本来进行隧道文件下载,因为我们不希望公开可下载文件的绝对路径:
header("Content-Type: $ctype");
header("Content-Length: " . filesize($file));
header("Content-Disposition: attachment; filename=\"$fileName\"");
readfile($file);
Run Code Online (Sandbox Code Playgroud)
不幸的是,我们注意到最终用户无法恢复通过此脚本传递的下载.
有没有办法支持这种基于PHP的解决方案的可恢复下载?
无论是从控制台还是在我的标签中,我都无法使用javascript设置html5视频元素的当前时间.我也在使用jQuery,但我不知道这是否与问题有关.我在Ubuntu上使用Google Chrome 24.0.1312.57; 下面是我想要做的一个例子
<html>
<script type="text/javascript">
var video = document.getElementById("video");
var videoSourceString = "<source src=http://URL:PORT" + path + " type='video/mp4'></source>";
$(video).html(videoSourceString);
video.load();
var frameRate = 24;
video.currentTime += 1/frameRate;// doesn't do anything, leaves currentTime same as before
</script>
<body>
<video id="video">
</video>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
视频播放和暂停很好,但每当我尝试手动更改时间时它都不起作用.
我已经查看了HTML5视频 - Chrome - 错误设置currentTime,并且控制台中没有此类错误,实际上它不会显示任何错误.我也无法使用video.currentTime + = 1或document.getElementById("video")从控制台更改currentTime.当前时间= 0,任意数字.
非常感谢你!
我正在尝试制作自己的HTML5视频播放器,我正在使用此代码更改视频的当前时间:
$(document).ready(function(){
...
//controls.total is my seekbar
controls.total.click(function(e) {
var x = e.pageX;
var prog = $(this);
var maxduration = video.duration;
var position = x - prog.offset().left;
var percentage = 100 * position / prog.width();
if(percentage > 100) {
percentage = 100;
}
if(percentage < 0) {
percentage = 0;
}
controls.progress.css('width',percentage+'%');
if ( video.seekable.length > 0 ) {
video.currentTime = maxduration * percentage / 100;
}
});
...
}
Run Code Online (Sandbox Code Playgroud)
它的工作方式与IE9,Edge和Firefox一样.但它在Chrome中不起作用.它只是将currentTime设置为0.为什么?
当我尝试在Chrome 5.0.375.86中设置HTML5 Video元素的currentTime时:
video.currentTime = 1.0;
Run Code Online (Sandbox Code Playgroud)
我收到以下javascript异常:
Uncaught Error: INDEX_SIZE_ERR: DOM Exception 1
Run Code Online (Sandbox Code Playgroud)
它在Safari中运行良好.有没有人经历过这个?