-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdesktop8.php
225 lines (198 loc) · 7.36 KB
/
desktop8.php
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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
<?php
$servername ="localhost";
$username = "root";
$password ="";
$dbname = "responsiveform1";
$conn = mysqli_connect($servername,$username,$password,$dbname);
if($conn)
{
// echo "connection ok";
}
else
{
echo "connection failed";
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>
<style>
.bi-arrow-left-circle-fill,
.svg-arrow {
left: -650px;
position: relative;
z-index: 2; /* Set a higher z-index value to bring the arrow on top */
top:74px
}
.arrow-container a {
text-decoration: none;
color: inherit; /* Inherit the color from the parent container */
cursor: pointer; /* Show the hand cursor on hover */
}
.arrow-container {
position: relative;
top: 4px;
}
.arrow-container svg {
width: 24px; /* Adjusted size to 24px */
height: auto;
}
.arrow-container a {
text-decoration: none;
color: black;
cursor: pointer;
}
body {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
font-family: Arial, sans-serif;
background-color: #7D9682; /* Background color */
}
#video-container {
display: flex;
flex-direction: column;
align-items: center;
background-color: #fff;
padding: 20px;
border-radius: 8px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
margin-bottom: 20px; /* Adjusted margin */
top: 300px
}
video {
max-width: 100%;
max-height: 200px;
margin: 10px;
border-radius: 6px;
}
button {
padding: 10px;
font-size: 16px;
margin: 10px;
cursor: pointer;
border: none;
background-color: #2ecc71; /* Button color */
color: #fff;
border-radius: 4px;
}
button:hover {
background-color: #27ae60; /* Button color on hover */
}
#local-video {
max-width: 100%;
max-height: 200px;
border: 1px solid #ccc;
margin: 10px;
background-color: #D9D9D9; /* Change to your desired color */
}
#remote-video {
max-width: 100%;
max-height: 200px;
border: 1px solid #ccc;
margin: 10px;
background-color: #D9D9D9; /* Change to your desired color */
}
</style>
</head>
<body>
<div id="video-container">
<video id="local-video" autoplay muted playsinline></video>
<video id="remote-video" autoplay playsinline></video>
<div id="call-controls">
<button id="start-call-btn" onclick="startCall()">Start Call</button>
<button id="accept-call-btn" onclick="acceptCall()" style="display: none;">Accept Call</button>
<button id="reject-call-btn" onclick="rejectCall()" style="display: none;">Reject Call</button>
<button id="end-call-btn" onclick="endCall()" style="display: none;">End Call</button>
</div>
<div id="call-status"></div>
</div>
<div class="arrow-container" style="position: absolute;">
<a href="http://localhost/learningphp/dbform6.php" style="text-decoration: none; color: black;">
<i class="bi bi-arrow-left-circle-fill"></i>
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left-circle-fill" viewBox="0 0 16 16">
<path d="M8 0a8 8 0 1 0 0 16A8 8 0 0 0 8 0m3.5 7.5a.5.5 0 0 1 0 1H5.707l2.147 2.146a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 1 1 .708.708L5.707 7.5z"/>
</svg>
</a>
</div>
<script>
const localVideo = document.getElementById('local-video');
const remoteVideo = document.getElementById('remote-video');
const startCallBtn = document.getElementById('start-call-btn');
const acceptCallBtn = document.getElementById('accept-call-btn');
const rejectCallBtn = document.getElementById('reject-call-btn');
const endCallBtn = document.getElementById('end-call-btn');
const callStatus = document.getElementById('call-status');
let localStream;
let remoteStream;
let isCaller;
let isRecording = false;
async function startCall() {
try {
localStream = await navigator.mediaDevices.getUserMedia({ video: true, audio: true });
localVideo.srcObject = localStream;
// Simulate an incoming call after a delay (you can replace this with your notification logic)
setTimeout(() => {
handleIncomingCall();
}, 2000);
} catch (error) {
console.error('Error starting call:', error);
}
}
function handleIncomingCall() {
isCaller = true;
callStatus.textContent = 'Incoming Call...';
startCallBtn.style.display = 'none';
acceptCallBtn.style.display = 'inline-block';
rejectCallBtn.style.display = 'inline-block';
}
async function acceptCall() {
callStatus.textContent = 'Call Accepted';
acceptCallBtn.style.display = 'none';
rejectCallBtn.style.display = 'none';
endCallBtn.style.display = 'inline-block';
// Simulate the remote stream being available after a delay (you can replace this with your logic)
setTimeout(() => {
handleRemoteStream();
}, 2000);
}
function handleRemoteStream() {
remoteStream = localStream; // In this example, both local and remote use the same stream
remoteVideo.srcObject = remoteStream;
}
function rejectCall() {
stopRecording(); // Stop recording (simulated function, replace with your recording logic)
localStream.getTracks().forEach(track => track.stop());
localVideo.srcObject = null;
remoteVideo.srcObject = null;
callStatus.textContent = 'Call Rejected';
startCallBtn.style.display = 'inline-block';
acceptCallBtn.style.display = 'none';
rejectCallBtn.style.display = 'none';
}
function endCall() {
stopRecording(); // Stop recording (simulated function, replace with your recording logic)
localStream.getTracks().forEach(track => track.stop());
localVideo.srcObject = null;
remoteVideo.srcObject = null;
callStatus.textContent = 'Call Ended';
startCallBtn.style.display = 'inline-block';
acceptCallBtn.style.display = 'none';
rejectCallBtn.style.display = 'none';
endCallBtn.style.display = 'none';
}
// Simulated function to stop recording (replace with your recording logic)
function stopRecording() {
if (isRecording) {
console.log('Recording stopped.');
isRecording = false;
}
}
</script>
</body>
</html>