Introduction to the progress bar of video and audio tags in Html5; Introduction to html5

Source: Internet
Author: User

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
  1. Response. setHeader ("Cache-Control", "max-age = 31536000, must-revalidate ");
  2. Response. setHeader ("Content-Length", file. length () + "");
  3. If (fileName. contains (". mp4 ")){
  4. Response. setContentType ("video/mpeg4 ");
  5. }
  6. If (fileName. contains (". mp3 ")){
  7. Response. setContentType ("audio/mpeg ");
  8. Response. setHeader ("Accept-Ranges:", "bytes ");
  9. }

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.