HTML and CSS Reference
In-Depth Information
20
,
240
);
context
.
fillText
(
"Can Play MP3: "
+
audioElement
.
canPlayType
(
"audio/mp3"
),
20
,
260
);
}
var
var
theCanvas
=
document
.
getElementById
(
"canvasOne"
);
var
var
context
=
theCanvas
.
getContext
(
"2d"
);
var
var
audioElement
=
document
.
getElementById
(
"theAudio"
);
audioElement
.
play
();
function
function
gameLoop
() {
window
.
setTimeout
(
gameLoop
,
20
);
drawScreen
()
}
gameLoop
();
}
<
/script>
</head>
</head>
<body>
<body>
<div
<div style=
"position: absolute; top: 50px; left: 50px;"
>
<canvas
<canvas id=
"canvasOne"
width=
"500"
height=
"300"
>
Your browser does not support HTML5 Canvas.
</canvas>
</canvas>
</div>
</div>
<div
<div id=
"loadingStatus"
>
0%
</div>
</div>
<div
<div style=
"position: absolute; top: 50px; left: 600px; "
>
<audio
<audio id=
"theAudio"
controls >
<source
<source src=
"song1.mp3"
type=
"audio/mp3"
>
<source
<source src=
"song1.ogg"
type=
"audio/ogg"
>
<source
<source src=
"song1.wav"
type=
"audio/wav"
>
Your browser does not support the audio element.
</audio>
</audio>
</div>
</div>
</body>
</body>
</html>
</html>