Skip to content
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
85 lines (71 sloc) 2.53 KB
<!DOCTYPE html>
<script src="modules/hls.js/dist/hls.min.js" charset="utf-8"></script>
<script src="modules/tone/build/Tone.min.js" charset="utf-8"></script>
<script src="/websocket" charset="utf-8"></script>
<link rel="stylesheet" href="assets/hiq.css">
<h1>Radio internal</h1>
<p>This is the internal part of the radio app that runs in the radio itself</p>
<p>Users never see this page. Playing audio on this page will play it through whichever sound output the browser is using.</p>
<audio id="audio"></audio>
<audio id="media"></audio>
const stream = "";
// Example of playing an HLS stream
// via the Hls.js library
// See:
function playHlsStream() {
if (Hls.isSupported()) {
var media = document.getElementById('media');
var hls = new Hls();
hls.on(Hls.Events.MANIFEST_PARSED, function () {;
// Generates some sounds using the Tone.js library
// See:
const polySynth = new Tone.PolySynth(4, Tone.Synth).toMaster();
function playChord() {
polySynth.triggerAttack(['C4', 'E4', 'G4', 'B4']);
setTimeout(stopChord, 1000);
function stopChord() {
polySynth.triggerRelease(['C4', 'E4', 'G4', 'B4'])
function stopAll() {
var medias = document.querySelectorAll('audio');
function (mediaEl) {
console.log('%cHello!', 'color:blue;font-weight:bold', 'messages from the server');
// Creates a websocket connection to commuicate
// with the external page and other services
const ws = createWebsocket({ debug: true });
ws.subscribe(new RegExp('radio/command/.*'), ({ topic, payload }) => {
console.log(topic, payload);
if (topic.includes("play")) {
var audio_file = payload.params.file;
var a = document.querySelector("#audio");
a.setAttribute("src", "assets/audio/" + audio_file);
a.setAttribute("autoplay", "autoplay");
} else if (topic.includes("hls")) {
} else if (topic.includes("chord")) {
} else if (topic.includes("stop")) {
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.