b10b4f390d
- Modified code to enable the broadcaster to act as a TURN server using Hyperswarm connections. - Replaced external STUN/TURN servers with custom signaling over Hyperswarm. - Configured RTCPeerConnection with an empty ICE servers array to prevent reliance on external servers. - Implemented custom signaling protocol for exchanging offers, answers, and ICE candidates over Hyperswarm connections. - Updated broadcaster to relay media streams, effectively mimicking TURN server behavior within the Hyperswarm network. - Adjusted peer connection setup for both broadcaster and listener to use Hyperswarm for signaling and data transport. - Removed dependency on third-party servers; all communication now occurs within the peer-to-peer network. - Updated UI elements and controls to reflect the changes. - Ensured that peer count updates correctly with new connection handling.
99 lines
3.8 KiB
HTML
99 lines
3.8 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<link href="./assets/bootstrap.min.css" rel="stylesheet">
|
|
<title>pearCast</title>
|
|
<style>
|
|
#titlebar {
|
|
-webkit-app-region: drag;
|
|
height: 30px;
|
|
width: 100%;
|
|
background-color: #343a40;
|
|
}
|
|
body {
|
|
margin: 0;
|
|
font-family: Arial, sans-serif;
|
|
}
|
|
pear-ctrl[data-platform="darwin"] {
|
|
float: left;
|
|
margin-top: 15px;
|
|
margin-left: 5px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body class="bg-dark text-light">
|
|
<div id="titlebar">
|
|
<pear-ctrl></pear-ctrl>
|
|
</div>
|
|
<div class="container mt-5 text-center">
|
|
<h1>pearCast</h1>
|
|
<div id="setup" class="btn-group mt-4">
|
|
<button id="create-station" class="btn btn-primary">Create Station</button>
|
|
<button id="open-join-modal" class="btn btn-secondary" data-bs-toggle="modal" data-bs-target="#joinModal">Join Station</button>
|
|
</div>
|
|
<div id="controls" class="d-none mt-4">
|
|
<p id="station-info"></p>
|
|
<button id="leave-stream" class="btn btn-danger mt-2">Leave Broadcast</button>
|
|
|
|
<!-- Broadcaster-only Controls -->
|
|
<div id="broadcaster-controls" class="mt-3 d-none">
|
|
<label for="audio-input-select" class="form-label">Select Audio Input Source:</label>
|
|
<select id="audio-input-select" class="form-select"></select>
|
|
<button id="apply-audio-source" class="btn btn-success mt-2">Apply</button>
|
|
</div>
|
|
|
|
<!-- Listener-only Controls -->
|
|
<div id="listener-controls" class="mt-3 d-none">
|
|
<!-- You can add listener-specific controls here -->
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Join Modal -->
|
|
<div class="modal fade" id="joinModal" tabindex="-1" aria-labelledby="joinModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content bg-dark text-light">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="joinModalLabel">Join a Station</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<input type="text" id="station-id" class="form-control" placeholder="Enter Station ID">
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
|
<button type="button" class="btn btn-primary" id="join-station-button">Join</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Create Station Modal -->
|
|
<div class="modal fade" id="createStationModal" tabindex="-1" aria-labelledby="createStationModalLabel" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content bg-dark text-light">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="createStationModalLabel">Create Station</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<p>Generate a new station ID or use an existing ID?</p>
|
|
<button id="generate-new-key" class="btn btn-primary mt-2">Generate New ID</button>
|
|
<input type="text" id="existing-key" class="form-control mt-3" placeholder="You may manually enter an ID here">
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Cancel</button>
|
|
<button type="button" class="btn btn-primary" id="create-station-button">Create Station</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Bootstrap JavaScript Bundle (includes Popper) -->
|
|
<script src="./assets/bootstrap.bundle.min.js"></script>
|
|
<script type="module" src="app.js"></script>
|
|
</body>
|
|
</html>
|