HTML5 Audio

Everything you need to know about HTML5
Site Admin
Posts: 159
Joined: Sun Jun 26, 2022 10:46 pm

HTML5 Audio

Post by C0D3D »

Embedding audio in HTML documents

Example 1

Code: Select all

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Embedding Audio into an HTML Page</title>
</head>
<body>
	<audio controls="controls" src="/music/s1.mp3">
        Your browser does not support the HTML5 audio element.
    </audio>
</body>
</html> 
Defining alternative sources for audio element

Example 2

Code: Select all

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Specify Alternate Sources for audio Element in HTML</title>
</head>
<body>
    <audio controls="controls">
        <source src="/music/s1.mp3" type="audio/mpeg">
        <source src="/music/s1.ogg" type="audio/ogg">
        Your browser does not support the HTML5 audio element.
    </audio>
</body>
</html>  
Linking the audio files

Example 3

Code: Select all

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Linking Audio Files in HTML</title>
</head>
<body>
    <p><a href="/music/s1.mp3">Track 1</a></p>
    <p><a href="/music/s1.mp3">Track 2</a></p>
</body>
</html>
Inserting audio in HTML documents using the object element

Example 4

Code: Select all

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Inserting Audio Using object Element</title>
</head>
<body>
    <object data="/music/s1.mp3"></object>
    <object data="/music/s1.ogg"></object>
</body>
</html>
Inserting audio in HTML documents using the embed element

Example 5

Code: Select all

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>Inserting Audio Using embed Element</title>
</head>
<body>
    <embed src="/music/s1.mp3">
    <embed src="/music/s1.ogg">
</body>
</html>
----------------------------------------------------------------------
Together we are one! One we are many... Much Love from one brother to another...
Working together to achieve amazing things!
Teamwork is key.
Knowledge is Power!

4 Basic datatypes.
Strings: Which store a series of characters.
Int: Which store a full integer or number.
Float: A numeric value with a decimal.
Boolean: Only stores True or False and are very useful with if statements

----------------------------------------------------------------------
ImgBB Image upload

Who is online

Users browsing this forum: No registered users and 0 guests