Improve Accessibility of Audio Content with the audio Element
HTML5'saudioelement gives semantic meaning when it wraps sound or audio stream content in your markup. Audio content also needs a text alternative to be accessible to people who are deaf or hard of hearing. This can be done with nearby text on the page or a link to a transcript.
Theaudiotag supports thecontrolsattribute. This shows the browser default play, pause, and other controls, and supports keyboard functionality. This is a boolean attribute, meaning it doesn't need a value, its presence on the tag turns the setting on.
Note:Multimedia content usually has both visual and auditory components. It needs synchronized captions and a transcript so users with visual and/or auditory impairments can access it. Generally, a web developer is not responsible for creating the captions or transcript, but needs to know to include them.
Time to take a break from Camper Cat and meet fellow camper Zersiax (@zersiax), a champion of accessibility and a screen reader user. To hear a clip of his screen reader in action, add anaudioelement after thep. Include thecontrolsattribute. Then place asourcetag inside theaudiotags with thesrcattribute set tohttps://s3.amazonaws.com/freecodecamp/screen-reader.mp3andtypeattribute set to"audio/mpeg".
Note:The audio clip may sound fast and be difficult to understand, but that is a normal speed for screen reader users.