-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
96 lines (88 loc) · 2.98 KB
/
Copy pathindex.html
File metadata and controls
96 lines (88 loc) · 2.98 KB
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
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>포토부스</title>
<style>
body {
text-align: center;
background-color: aliceblue;
font-family: Arial, sans-serif;
}
#video {
width: 640px;
height: 480px;
margin: 20px auto;
border: 2px solid lightgray;
display: inline-block;
}
button {
margin: 10px;
padding: 10px 20px;
font-size: 16px;
font-weight: bold;
border: 1px solid #ccc;
border-radius: 5px;
cursor: pointer;
background-color: white;
}
button:active {
background-color: blue;
color: white;
}
#countdown {
font-size: 24px;
font-weight: bold;
margin-top: 10px;
color: darkblue;
visibility: hidden;
}
</style>
<script src="https://cdn.socket.io/4.0.1/socket.io.min.js"></script>
<script>
const socket = io();
socket.on('countdown', function(data) {
const countdown = document.getElementById('countdown');
countdown.innerText = ${data.time}초 남음;
countdown.style.visibility = 'visible';
if (data.time === 0) {
countdown.style.visibility = 'hidden';
}
});
function startCountdown() {
fetch('/start_countdown').then(response => response.text()).then(result => {
alert(result);
});
}
async function setFilter(filter) {
const response = await fetch('/set_filter', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ filter: filter }),
});
const result = await response.text();
console.log(result); // 디버깅 로그
const video = document.getElementById('stream');
video.src = /video_feed?filter=${filter}×tamp=${Date.now()};
}
</script>
</head>
<body>
<h1>포토부스</h1>
<p>필터를 선택하여 사진을 찍어보세요!</p>
<!-- 필터 선택 버튼 -->
<button onclick="setFilter('cat')">😻 고양이</button>
<button onclick="setFilter('bunny')">🐰 토끼</button>
<button onclick="setFilter('dog')">🐶 강아지</button>
<button onclick="setFilter('angel')">👼 천사</button>
<button onclick="setFilter('devil')">😈 악마</button>
<hr>
<div id="video">
<img id="stream" src="/video_feed" alt="실시간 스트리밍">
</div>
<p id="countdown">10초</p>
<hr>
<button onclick="startCountdown()">📸 사진 촬영</button>
</body>
</html>