-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathindex.html
100 lines (86 loc) · 2.07 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
<!DOCTYPE html>
<html lang="en" data-bs-theme="dark">
<head>
<title>Upload dan Streaming Video</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
<link rel="stylesheet" type="text/css" href="style.css">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<style>
* {
box-sizing: border-box;
}
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
}
.container {
max-width: 600px;
margin: auto;
padding: 20px;
}
h1 {
text-align: center;
}
form {
display: flex;
flex-direction: column;
margin-top: 20px;
}
input[type="file"] {
margin-bottom: 10px;
}
button[type="submit"] {
background-color: #4CAF50;
color: white;
padding: 10px;
border: none;
border-radius: 4px;
cursor: pointer;
}
button[type="submit"]:hover {
background-color: #45a049;
}
#video-player {
margin-top: 20px;
}
#video {
width: 100%;
height: auto;
}
@media screen and (max-width: 600px) {
.container {
padding: 10px;
}
}
</style>
</head>
<body>
<div class="container">
<h1>Upload dan Streaming Video</h1>
<form method="post" action="upload.php" enctype="multipart/form-data">
<input type="file" name="video" required>
<button type="submit" name="submit">Upload</button>
</form>
<div id="video-player">
<video id="video" controls></video>
</div>
</div>
<script src="script.js"></script>
<script>
const video = document.getElementById('video');
function playVideo(src) {
video.src = src;
video.load();
video.play();
}
// When a file is selected, play the video
const fileInput = document.querySelector('input[type="file"]');
fileInput.addEventListener('change', () => {
const file = fileInput.files[0];
const url = URL.createObjectURL(file);
playVideo(url);
});
</script>
</body>
</html>