一、问题描述
在开发页面的过程中,使用了video标签引入视频文件。视频可以正常播放,但是进度条无法控制视频进度,一点就会回到起点。
二、问题分析
正常可以操作的请求如下:
主要响应头多了以下属性:
add_header Accept-Ranges bytes;
add_header Content-Length 10215923;
add_header Content-Range 'bytes 0-10215922/10215923';
三、解决方法
在nginx配置中添加
location /static {
proxy_pass https://adc-static.$adc_ns.svc.cluster.local:18443;
}
location ~ /0324.fc8cc0f5.mp4 {
add_header Accept-Ranges bytes;
add_header Content-Length 10215923;
add_header Content-Range 'bytes 0-10215922/10215923';
proxy_pass https://adc-static.$adc_ns.svc.cluster.local:18443;
}
注:
proxy_pass 后面跟的是转发请求地址
Content-Length 后面跟的是视频的大小