YouTip LogoYouTip

Html Sounds

* * * Sound can be played in HTML in different ways. * * * ## Problems and Solutions Playing audio in HTML is not easy! You need to be well-versed in a lot of techniques to ensure your audio files can play in all browsers (Internet Explorer, Chrome, Firefox, Safari, Opera) and on all hardware (PC, Mac, iPad, iPhone). In this chapter, the Novice Tutorial summarizes the problems and solutions for you. * * * ## Using Plugins Browser plugins are small computer programs that extend the standard functionality of a browser. Plugins can be added to a page using the tag or the tag. These tags define a container for resources (usually non-HTML resources), which will be displayed either by the browser or by an external plugin depending on the type. * * * ## Using the Element The tag defines a container for external (non-HTML) content. (This is an HTML5 tag, illegal in HTML4, but works in all browsers). The following code snippet can display an MP3 file embedded in a webpage: ## Example [Try it Β»]( ### **Problems:** * The tag is invalid in HTML 4. The page cannot pass HTML 4 validation. * Different browsers support different audio formats differently. * If the browser does not support the file format, the audio cannot be played without a plugin. * If the user's computer does not have the plugin installed, the audio cannot be played. * If you convert the file to another format, it still may not play in all browsers. * * * ## Using the Element The tag can also define a container for external (non-HTML) content. The following code snippet can display an MP3 file embedded in a webpage: ## Example [Try it Β»]( ### **Problems:** * Different browsers support different audio formats differently. * If the browser does not support the file format, the audio cannot be played without a plugin. * If the user's computer does not have the plugin installed, the audio cannot be played. * If you convert the file to another format, it still may not play in all browsers. * * * ## Using the HTML5