Home  >  Article  >  Web Front-end  >  Solution to the audio format supported by audio in html5

Solution to the audio format supported by audio in html5

青灯夜游
青灯夜游forward
2018-10-09 15:56:206070browse

HTML5 Audio tag can support wav, mp3, ogg, acc, webm and other formats, but there is a very important music file format midi (extension mid) that does not have built-in support in major browsers. Not all browsers support MP3 OGG and the like. Each browser supports different formats due to copyright issues. This article will introduce to you the solution for audio support audio format in HTML5. Friends who are interested should take a look. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Browser and Audio Compatibility

Not all browser manufacturers agree on the use of a certain audio file format. For images, files in PNG, JPEG, or GIF format will load into your page on any browser. Unfortunately, this is not the case with audio files. Table 1 shows the audio file formats that can be used in web pages, but not all formats are available in all browsers. For example, Chrome, Internet Explorer 9 (IE9), and Safari browsers do not support WAV files, a declining standard that uses an uncompressed format.

HTML5 Browser and Audio Format Compatibility

##Audio FormatChrome FirefoxIE9OperaSafari##OGGMP3WAVThere is no universal file format that every browser All using a single file format means that at least 2/5 browsers will not be able to play certain sounds. This isn't a matter of browser makers being intransigent and unable to agree on a single audio standard, but rather a legal and financial issue involving patent rights and royalties. The OGG format, which is not restricted by software patents, aims to solve this problem once and for all. However, at the time of writing, neither Opera nor Safari support OGG. There are a lot more WAV and MP3 files available than there are files in the OGG format, so no doubt browser manufacturers have taken this into consideration. MP3 as the de facto standard is a great solution.
Support Support Supported Not supported Not supported
Supported Not supported Supported Not supported Supported
Not supported Supported Not supported Supported Not supported

Solution: Use three file types and the b97864c2e0ef2353a16c4d64c7734e92 tagGiven the current situation, you may think that it is not yet possible to The golden moment for using audio on HTML5 pages. In some ways this may be true, but HTML5 provides a solution that enables your favorite browser to find a compatible format.

When used in conjunction with the b97864c2e0ef2353a16c4d64c7734e92 tag, the e02da388656c3265154666b7c71a8ddc tag can be nested within the b97864c2e0ef2353a16c4d64c7734e92 container. Let's say you're a Wagner fan and want to listen to his opera Ride of the Valkyries on an HTML5 page. First, you need to get your music in three file types, namely OGG, MP3, and WAV. Place these music files in the same folder as the HTML5 files. Then, put each file name in a separate e02da388656c3265154666b7c71a8ddc tag, and all source tags in the audio container are composed of b97864c2e0ef2353a16c4d64c7734e9281d2bc32cafa2076a27f10cdd878d0ab, as shown below.

No matter what browser your visitor is using, it will automatically select the first file type it reads and play the sound for you.

SummaryThe above is the complete content of the audio support audio format solution in HTML5 introduced to you. I hope it can be helpful to everyone. Learning helps. For more related tutorials, please visit

Html5 Video Tutorial

! Related recommendations:

php public welfare training video tutorial

HTML5 graphic tutorial

HTML5Online Manual

The above is the detailed content of Solution to the audio format supported by audio in html5. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:jb51.net. If there is any infringement, please contact admin@php.cn delete