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
|
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Radio Station Emulator</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet preload" href="./css/styles.css" type="text/css" as="style"/>
</head>
<body>
<div>
<div class="header">
<img class="logo" src="./img/logo.jpg"/>
<div>
<h1>Radio Station Emulator</h1>
<em>by <a href="https://kaotisk-hund.com/" target="_blank">Kaotisk Hund</a>, for <a href="https://arching-kaos.org" target="_blank">Arching Kaos</a> and for everyone.</em>
</div>
</div>
<div class="main">
<div class="start-top">
<div class="div-groups">
<div class="now-playing-details">
<div class="div-groups-row">
<img class="generated"/>
<table>
<tr>
<th>Artist</th>
<td class="artist"></td>
</tr>
<tr>
<th>Title</th>
<td class="title"></td>
</tr>
<tr>
<th>Starts On (ms)</th>
<td class="starts-on"></td>
</tr>
<tr>
<th>Duration (s)</th>
<td class="show-duration"></td>
</tr>
</table>
</div>
</div>
<div class="enhanced-player">
<div class="radio-player">
<audio preload="auto" controls muted></audio>
</div>
<div class="div-row">
<button onclick="sync_radio()">Sync!</button>
<details style="width:100%;">
<summary>Details</summary>
<div>
<p>Download progress:</p>
<progress class="dl-progress" max="100"></progress>
</div>
<div>
<p>Live progress:</p>
<progress class="play-progress"></progress>
</div>
<div class="div-inline">
<div class="div-inline">
<p>Listening at:</p>
<p class="listening-at"></p>
</div>
<div class="div-inline">
<p>Show playback: </p>
<div class="no-break">
<p class="relative-time"></p>
<p>/</p>
<p class="show-duration"></p>
</div>
</div>
</div>
</details>
</div>
</div>
</div>
<div class="previously-played">
</div>
</div>
<div class="more-details">
<h2>More details</h2>
<details >
<summary>Info to get you started</summary>
<h2>Notice</h2>
<p>
If you are visiting for the first time, you might need to
"Allow Audio" first. Please do and refresh the page.
</p>
<h2>About</h2>
<p>
This is a "Radio Station Emulator". We create lists with
shows to be played, but since we are not doing streaming of
the playlists, we offer another way of "tuning in".
</p>
<p>
Providing the time a list started playing and having
pre-calculated the starting timestamps of each show relevant
to the list start timestamp, we can calculate which show is
on and what its current time of playing is.
</p>
<p>
Ultimately, you are hearing what we would be streaming, as
you would do for a regular radio station.
</p>
<h2>Steps</h2>
<ol>
<li>
First, your browser is going to ask our server here,
what is the current list that plays right now. It will
get a response and will fetch that list.
</li>
<li>
Based on properties of the list overall and the time of
visit, your browser will start comparing each show's
properties found in the list, to figure the relative
time of yours on the list. A progress bar labeled "Live
progress" will be indicating the correct time on the
show.
</li>
<li>
Having figured out the show that is playing, it will go
and download the whole show. Progress of that would be
observable via the "Download progress" bar below.
</li>
<li>
Upon completion of the download, the "Sync" button is
auto pressed and the player start playing the show from
the calculated second it calculated previously.
</li>
</ol>
<h2>Notes</h2>
<ul>
<li>
Sometimes, you might need to press the "Sync" button
more than once. That's mostly due to bandwidth
capabilities of both the server and the client. The
"tune" would be right if you press it multiple times and
land near the same timespace over and over.
</li>
<li>
Ideally, if "Listening at:" and "Show playback:" have
the same value then you are in sync!
</li>
</ul>
</details>
<details>
<summary>Sync info</summary>
<div class="groups">
<table>
<tr>
<th>Time of visit (ms)</th>
<td class="time-of-visit"></td>
</tr>
<tr>
<th>Time elapsed since visited (s)</th>
<td class="you-are-here"></td>
</tr>
<tr>
<th>List started on (ms)</th>
<td class="started-on"></td>
</tr>
<tr>
<th>List duration (s)</th>
<td class="list-duration"></td>
</tr>
</table>
<h3>Calculations</h3>
<table>
<tr>
<th>Times Fully Played</th>
<td class="min-played"></td>
</tr>
<tr>
<th>Times Played</th>
<td class="max-played"></td>
</tr>
<tr>
<th>Dt = TP - TFP</th>
<td class="d-t"></td>
</tr>
<tr>
<th>Delta time</th>
<td class="delta-time"></td>
</tr>
<tr>
<th>Initial "tune in" time (s)</th>
<td class="current-time"></td>
</tr>
</table>
</div>
</details>
<details>
<summary>Data segments</summary>
<h3>Hash of list</h3>
<pre class="list-hash"></pre>
<h3>List info (JSON)</h3>
<pre class="list-info"></pre>
<h3>Hash of current show</h3>
<pre class="current-show-hash"></pre>
<h3>Show info (JSON)</h3>
<pre class="show-info"></pre>
<div>
<a href="./data.html" target="_blank">Data</a>
</div>
</details>
</div>
</div>
</div>
<script src="./js/radio_emulator.js"></script>
</body>
</html>
|