处理视频第一次加载慢的问题
This commit is contained in:
parent
2c6f7e25b1
commit
ab042b367d
@ -251,6 +251,8 @@ public class FileServiceImpl extends AbstractService implements IFileService {
|
||||
* @param contentLength
|
||||
*/
|
||||
private void setRangeHeader(long startRange, long endRange, HttpServletResponse response, String fileId, long contentLength) {
|
||||
// 这里不设置,会出现第一次加载很慢的情况
|
||||
response.setHeader("Content-Length", String.valueOf(contentLength - startRange));
|
||||
response.setHeader("Content-Range", String.format("bytes %d-%d/%d", startRange, endRange, contentLength));
|
||||
response.setHeader("Accept-Ranges", "bytes");
|
||||
response.setHeader("Etag", fileId);
|
||||
|
Loading…
Reference in New Issue
Block a user