HTML5μ <video>
μμλ μΉ νμ΄μ§μμ λμμμ μ¬μνλ λ° μ¬μ©λ©λλ€. μλλ κ°λ¨ν <video>
μμλ₯Ό μ΄μ©ν λͺ κ°μ§ μμμ
λλ€.
html<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Video Example</title>
</head>
<body>
<video width="640" height="360" controls>
<source src="example.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
</body>
</html>
html<video width="640" height="360" controls>
<source src="example.mp4" type="video/mp4">
<source src="example.webm" type="video/webm">
Your browser does not support the video tag.
</video>
html<video width="640" height="360" controls autoplay loop>
<source src="example.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
html<video width="640" height="360" controls poster="poster.jpg">
<source src="example.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
html<video width="640" height="360" controls>
<source src="example.mp4" type="video/mp4">
<track label="Korean" kind="subtitles" srclang="ko" src="subtitles_ko.vtt" default>
<track label="English" kind="subtitles" srclang="en" src="subtitles_en.vtt">
Your browser does not support the video tag.
</video>
html<video width="640" height="360" controls id="myVideo">
<source src="example.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
<script>
var video = document.getElementById("myVideo");
video.onplay = function() {
console.log("Video is playing");
};
video.onended = function() {
console.log("Video has ended");
};
</script>
μ΄λ¬ν μμλ€μ <video>
μμμ λ€μν μμ±κ³Ό κΈ°λ₯μ 보μ¬μ£Όκ³ μμ΅λλ€. μ€μ νλ‘μ νΈμμλ λμμ νμΌ κ²½λ‘, μλ§ νμΌ κ²½λ‘ λ±μ μ€μ λ‘ μ¬μ©νλ κ°μΌλ‘ λ체ν΄μΌ ν©λλ€.