123 lines
3.9 KiB
PHP
123 lines
3.9 KiB
PHP
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>WebRTC Echo Example</title>
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/css/bootstrap.min.css">
|
|
<style>
|
|
.stream-container {
|
|
border: 1px solid #ddd;
|
|
border-radius: 8px;
|
|
padding: 20px;
|
|
margin-bottom: 20px;
|
|
height: 100%;
|
|
}
|
|
|
|
.video-container {
|
|
background-color: #f8f9fa;
|
|
border-radius: 8px;
|
|
margin-bottom: 20px;
|
|
position: relative;
|
|
width: 100%;
|
|
height: 300px;
|
|
}
|
|
|
|
video {
|
|
width: 100%;
|
|
height: 100%;
|
|
object-fit: cover;
|
|
border-radius: 8px;
|
|
}
|
|
|
|
audio {
|
|
display: none;
|
|
}
|
|
|
|
textarea {
|
|
resize: vertical;
|
|
}
|
|
|
|
.btn-group {
|
|
margin-bottom: 10px;
|
|
}
|
|
|
|
.btn-back {
|
|
text-decoration: none;
|
|
color: #fff;
|
|
background: #b7b7b7;
|
|
padding: 11px;
|
|
border-radius: 8px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container mt-5">
|
|
<h1 class="text-center mb-4">WebRTC Echo Example</h1>
|
|
<h4 class="text-left mb-4"><a href="/" class="btn-back">🔙 Back to examples</a></h4>
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="stream-container">
|
|
<h3>Local Stream</h3>
|
|
<div class="video-container">
|
|
<video id="localVideo" autoplay muted playsinline></video>
|
|
</div>
|
|
|
|
<audio id="localAudio" controls muted></audio>
|
|
|
|
<div class="data-channel mt-4">
|
|
<h5>Data Channel</h5>
|
|
<div class="mb-3">
|
|
<textarea id="localDataText" class="form-control" rows="4"
|
|
placeholder="Type message to send to remote peer..."></textarea>
|
|
</div>
|
|
<div class="btn-group">
|
|
<button id="sendLocalData" class="btn btn-primary">Send Message</button>
|
|
<button id="clearLocalData" class="btn btn-secondary">Clear</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<div class="stream-container">
|
|
<h3>Remote Stream (Echo)</h3>
|
|
<div class="video-container">
|
|
<video id="remoteVideo" autoplay playsinline></video>
|
|
</div>
|
|
|
|
<audio id="remoteAudio" controls></audio>
|
|
|
|
<div class="data-channel mt-4">
|
|
<h5>Received Data</h5>
|
|
<div class="mb-3">
|
|
<textarea id="remoteDataText" class="form-control" rows="4"
|
|
placeholder="Messages received will appear here..." readonly></textarea>
|
|
</div>
|
|
<button id="clearRemoteData" class="btn btn-secondary">Clear</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row mt-4">
|
|
<div class="col-12 text-center">
|
|
<div class="btn-group">
|
|
<button id="startButton" class="btn btn-success">Start Stream</button>
|
|
<button id="connectButton" class="btn btn-primary" disabled>Connect</button>
|
|
<button id="hangupButton" class="btn btn-danger" disabled>Hang Up</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php
|
|
include '../footer.php'
|
|
?>
|
|
|
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.0/js/bootstrap.bundle.min.js"></script>
|
|
<script type="application/javascript" src="/echo/signaling.global.js"></script>
|
|
<script type="application/javascript" src="/echo/index.js"></script>
|
|
</body>
|
|
</html>
|