Embedding AMP
Embedding AMP in an HTML page is a three-step process:
-
Include the AMP JS script
-
Provide embed-time configuration (set the media to play and configure any features)
-
Instantiate the AMP object, associating it with a div on the page. The player will take on the div’s size in a responsive manner.
<html>
<head>
<script src="amp.js"></script>
</head>
<body>
<div id="amp"></div>
<script>
var config = {
autoplay: true,
media: {
src: "http://projects.mediadev.edgesuite.net/customers/akamai/video/VfE.mp4",
type: "video/mp4"
}
};
var amp = akamai.amp.AMP.create("amp", config);
</script>
</body>
</html>