smcgateway-sv 0.4.2 → 0.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,7 +24,8 @@
24
24
  const STEP_MS = 10_000;
25
25
  const TICK_MS = 200;
26
26
 
27
- let windowStart = $state(new Date(Date.now() - WINDOW_MS));
27
+ // Default to a time window that ends at the end of the current minute
28
+ let windowStart = $state(new Date(Date.now() - WINDOW_MS + 60000));
28
29
  let windowEnd = $derived(new Date(windowStart.getTime() + WINDOW_MS));
29
30
  let segments: Segment[] = $state([]);
30
31
  let audioEl: HTMLAudioElement;
@@ -91,13 +92,15 @@
91
92
  }
92
93
 
93
94
  const seg = segments[segIdx];
95
+ activeSegment = seg;
94
96
  const offsetSec = (cursor - seg.start.getTime()) / 1000;
95
97
 
96
98
  if (!audioEl.src.endsWith(seg.url)) {
97
99
  // console.log('LOAD', seg.url, audioEl.src);
98
- activeSegment = seg;
99
100
  audioEl.src = seg.url;
100
- await audioEl.play().catch(console.error);
101
+ if (playing) {
102
+ await audioEl.play().catch(console.error);
103
+ }
101
104
  }
102
105
 
103
106
  if (Math.abs(audioEl.currentTime - offsetSec) > 0.5) {
@@ -252,11 +255,17 @@
252
255
  </div>
253
256
  <div class="d-flex justify-content-between">
254
257
  <div class="windowStartLabel">
255
- {windowStart.toLocaleTimeString()}
258
+ {windowStart.toLocaleTimeString([], {
259
+ hour: '2-digit',
260
+ minute: '2-digit'
261
+ })}
256
262
  </div>
257
263
  <div>{new Date(cursor).toLocaleString()}</div>
258
264
  <div class="windowEndLabel">
259
- {windowEnd.toLocaleTimeString()}
265
+ {windowEnd.toLocaleTimeString([], {
266
+ hour: '2-digit',
267
+ minute: '2-digit'
268
+ })}
260
269
  </div>
261
270
  </div>
262
271
  </div>
@@ -265,9 +274,11 @@
265
274
  {#snippet callInfo(call: Segment | undefined)}
266
275
  <div class="callinfo text-center mt-1">
267
276
  {#if call}
268
- Radio {call.from} [{call.to}]
277
+ <span class="active-radio">
278
+ Radio {call.from} [{call.to}]
279
+ </span>
269
280
  {:else}
270
- Idle
281
+ <span class="text-muted"> -- silence -- </span>
271
282
  {/if}
272
283
  </div>
273
284
  {/snippet}
@@ -326,4 +337,7 @@ cursor: {new Date(cursor).toISOString()}<br /> -->
326
337
  min-width: 2px;
327
338
  border-radius: 0;
328
339
  }
340
+ .active-radio {
341
+ font-weight: bold;
342
+ }
329
343
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "smcgateway-sv",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "author": "Kevin Golding <kevin.golding@smc-gateway.com> (https://smc-gateway.com)",
5
5
  "license": "MIT",
6
6
  "scripts": {