6-HTML Audio, Video, SVG and API's
6-HTML Audio, Video, SVG and API's
Graphic Elements
Dr. Maheswari S,
VIT Chennai
2
Multimedia Elements
Multimedia on the web is sound, music, videos, movies, and
animations.
Attributes
Example
<video width = “450” height = “340” controls autoplay>
<source src = “mov.ogg” type = “video/ogg”/>
<source src = “mov.webm” type = “video/webm”/>
Browser does not support the video tag
</video>
Syntax:
<video poster="URL">
Attribute Values: It contains a single value URL which specifies the link of source image. There are two
types of URL link which are listed below:
Syntax:
<video muted>
Example
<body style="text-align:center">
<h1 style="color:green"> VIT </h1>
<h2 style="font-family: Impact"> HTML Video muted Attribute </h2> <br>
<video id="Test_Video"
width="360"
height="240"
controls muted>
<source src="samplevideo.mp4" type="video/mp4">
</video>
</body>
Output
Canvas
It uses JavaScript to draw
graphics on a web page.
Rectangular area and control
every pixel of it.
Several methods - drawing
paths, boxes, circles,
characters, and adding
images.
Dr. Maheswari S VIT Chennai
13
Syntax
<canvas id="myCanvas" width="200“
height="100"></canvas>
To add border:
<canvas id="myCanvas" width="200" height="100“
style="border:1px solid #000000;">
</canvas>
Dr. Maheswari S VIT Chennai
14
Arc() method
The arc() method is used to create an arc/curve i.e. circles, or parts of circles.
Syntax:
arcTo() method
The canvas arcTo() Method is used to create an arc/curve between two tangents on the canvas.This method defines an
arc in the extension of a straight line or another figure. This method is generally used to create rounded corners.
Syntax:
Canvas - Circle
var c = document.getElementById("myCanvas");
var ctx = c.getContext("2d");
ctx.beginPath();
ctx.arc(95,50,40,0,2*Math.PI);
ctx.stroke();
<html>
<head>
<title> Draw a Star Using SVG</title>
</head>
<body>
<svg width="2000" height="2000">
<polygon points="100,9 50,200 180,75 10,75 160,200"
style="fill:blue;stroke:red;stroke-width:5;fill-rule:evenodd;" />
</svg>
</body>
</html>
Dr. Maheswari S VIT Chennai
20
HTML5 API’S
HTML Geo location
HTML Drag and Drop
HTML Local Storage
HTML Application Cache
HTML Web Workers
HTML SSE
Google map
<body>
<h1>My First Google Map</h1>
<div id="map" style="width:400px;height:400px;"></div>
<script>
function myMap() {
var mapOptions = {
center: new google.maps.LatLng(51.5, -0.12),
zoom: 10,
mapTypeId: google.maps.MapTypeId.HYBRID
}
var map = new google.maps.Map(document.getElementById("map"), mapOptions);
}
</script>
</body> Dr. Maheswari S VIT Chennai
23
Dr. Maheswari S VIT Chennai
THANK YOU