--- url: "https://web.dev/articles/audio-quick" titulek: "Quick guide to implementing the HTML5 audio tag | Articles | web.dev" h1: "Quick guide to implementing the HTML5 audio tag Stay organized with collections Save and categorize content based on your preferences." popis: "" jazyk: "en" kanonicka: "https://web.dev/articles/audio-quick" drobecky: ["Articles", "Quick guide to implementing the HTML5 audio tag"] zdroj: "live" wayback_snapshot: "" stazeno: "2026-09-13 23:12:50" znaku: 5842 slov: 588 kodovani: "iso-8859-2" sha256: "28f8fc031a69743501332f556420faa78a60605c23a5308271bc5543f6b21b36" --- Quick guide to implementing the HTML5 audio tag Stay organized with collections Save and categorize content based on your preferences. Ernest Delgado Step 1: Wrap your Flash object with the audio tag Those browsers that don't recognize the audio tag will load the Flash content instead. `` Step 2: Add the source reference We can add as many "source" lines and formats as we want. If the browser doesn't support one specific format it will fallback to the next one and so forth. `` Step 3: Add fallback to Flash To be safe, we need to add the fallback to a Flash audio player, in case the browser doesn't support any of the formats we specified. For instance, Firefox 3.5 only supports the audio tag with **Ogg** format, but we might only have the **mp3** file available. `
` To make it easier, we are using the [SWFObject](https://code.google.com/p/swfobject/) library to insert the Flash player via JavaScript. To include the library you can simply use the [Google AJAX Libraries API](https://code.google.com/apis/ajaxlibs/) inserting these two lines in your header: ` ` Step 4: Add the default controls to show the player These controls are not customizable (see examples at the end). Since these default controls will show up regardless of the supported format we will need to handle its visibility with the conditional we previously created. `
` Alternatively, you can create your own player using JavaScript and CSS. `
` Except as otherwise noted, the content of this page is licensed under the [Creative Commons Attribution 4.0 License](https://creativecommons.org/licenses/by/4.0/), and code samples are licensed under the [Apache 2.0 License](https://www.apache.org/licenses/LICENSE-2.0). For details, see the [Google Developers Site Policies](https://developers.google.com/site-policies). Java is a registered trademark of Oracle and/or its affiliates. Last updated 2010-02-05 UTC.