Introduction to the progress bar of video and audio tags in Html5; Introduction to html5
Recently, Html5 video and audio tags were used in the project to play video and audio files online. However, the progress bar is invalid after playing the video on the page,
After viewing w3c, I found that the html code is no different. I guess it would be useful if I used static html to use the video tag to play the progress bar of a local file?
I tried it and found that it could be used. Then, F12 checked the difference between playing a local video and the network response in the playback project, and found that there were more things in the response header, add these items to the background code one by one, and finally succeed!
Copy the content to the clipboard using JavaScript Code
- Response. setHeader ("Cache-Control", "max-age = 31536000, must-revalidate ");
- Response. setHeader ("Content-Length", file. length () + "");
- If (fileName. contains (". mp4 ")){
- Response. setContentType ("video/mpeg4 ");
- }
- If (fileName. contains (". mp3 ")){
- Response. setContentType ("audio/mpeg ");
- Response. setHeader ("Accept-Ranges:", "bytes ");
- }
The above is all about the progress bar of the video and audio tags in Html5 ~
Address: http://www.cnblogs.com/youcanyouup/archive/2016/07/25/5704429.html