Open In App
Related Articles

How to specify the type of the media resource in HTML5 ?

Improve Article
Improve
Save Article
Save
Like Article
Like

Here, we will see how to set the media type of the media resource using HTML. To select the media type of media resource we use the <source> tag. This tag is used to attach multimedia files like audio, video, and pictures to a web page or website. The <audio>, <video>, and <picture> elements contain the <source> element.

Syntax:

<source src="" type="">
   // Statements
</source>

Example: In this example, we will specify the media resources by using the <source> tag.

HTML




<!DOCTYPE html>
<html>
<head>
    <title>
        How to specify the media type
        of the media resource in HTML5?
    </title>
</head>
   
<body style="text-align: center;">
    <h1 style="color:green;">
        GeeksforGeeks
    </h1>
    <h3>
        How to specify the media type
        of the media resource in HTML5?
    </h3>
    <video width="400" height="350" controls>
        <source src=
                type="video/mp4">
    </video>
    </br></br>
    <audio controls>
        <source src=
                type="audio/mp3">
    </audio>
</body>
</html>

Output:


Last Updated : 06 Jun, 2023
Like Article
Save Article
Related Tutorials