-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauto-scroll-remote-control-demo.html
More file actions
571 lines (493 loc) ยท 19.3 KB
/
Copy pathauto-scroll-remote-control-demo.html
File metadata and controls
571 lines (493 loc) ยท 19.3 KB
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
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ChordMe Auto-Scroll & Remote Control Demo</title>
<style>
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
margin: 0;
padding: 2rem;
background: #f8f9fa;
color: #333;
line-height: 1.6;
}
.header {
text-align: center;
margin-bottom: 3rem;
padding: 2rem;
background: white;
border-radius: 12px;
box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}
.header h1 {
margin: 0 0 1rem 0;
color: #007bff;
font-size: 2.5rem;
}
.header p {
font-size: 1.1rem;
color: #666;
max-width: 600px;
margin: 0 auto;
}
.demo-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 2rem;
margin-bottom: 3rem;
}
.demo-card {
background: white;
padding: 2rem;
border-radius: 12px;
box-shadow: 0 2px 12px rgba(0,0,0,0.1);
}
.demo-card h3 {
margin: 0 0 1rem 0;
color: #007bff;
font-size: 1.5rem;
display: flex;
align-items: center;
gap: 0.5rem;
}
.demo-card .icon {
font-size: 1.75rem;
}
.feature-list {
list-style: none;
padding: 0;
margin: 1rem 0;
}
.feature-list li {
padding: 0.5rem 0;
border-bottom: 1px solid #eee;
display: flex;
align-items: center;
gap: 0.75rem;
}
.feature-list li:last-child {
border-bottom: none;
}
.checkmark {
color: #28a745;
font-weight: bold;
}
.demo-section {
background: white;
padding: 2rem;
border-radius: 12px;
box-shadow: 0 2px 12px rgba(0,0,0,0.1);
margin-bottom: 2rem;
}
.demo-section h2 {
margin: 0 0 1.5rem 0;
color: #007bff;
font-size: 1.75rem;
}
.button {
display: inline-block;
padding: 0.75rem 1.5rem;
background: #007bff;
color: white;
text-decoration: none;
border-radius: 8px;
font-weight: 500;
transition: all 0.2s;
border: none;
cursor: pointer;
font-size: 1rem;
}
.button:hover {
background: #0056b3;
transform: translateY(-1px);
}
.button.secondary {
background: #6c757d;
}
.button.secondary:hover {
background: #545b62;
}
.demo-controls {
display: flex;
gap: 1rem;
flex-wrap: wrap;
margin: 1.5rem 0;
}
.status-indicator {
display: inline-flex;
align-items: center;
gap: 0.5rem;
padding: 0.5rem 1rem;
background: #f8f9fa;
border: 1px solid #dee2e6;
border-radius: 6px;
font-size: 0.875rem;
font-weight: 500;
}
.status-indicator.active {
background: #d4edda;
border-color: #c3e6cb;
color: #155724;
}
.code-example {
background: #f8f9fa;
border: 1px solid #dee2e6;
border-radius: 6px;
padding: 1rem;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
font-size: 0.875rem;
overflow-x: auto;
margin: 1rem 0;
}
.voice-commands {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 1rem;
margin: 1rem 0;
}
.command-group {
background: #f8f9fa;
padding: 1rem;
border-radius: 6px;
border-left: 4px solid #007bff;
}
.command-group h4 {
margin: 0 0 0.5rem 0;
color: #007bff;
font-size: 1rem;
}
.command-group ul {
margin: 0;
padding-left: 1.25rem;
font-size: 0.875rem;
}
.command-group li {
margin: 0.25rem 0;
color: #666;
}
.emergency-warning {
background: #fff3cd;
border: 1px solid #ffeaa7;
border-radius: 6px;
padding: 1rem;
margin: 1rem 0;
color: #856404;
}
.emergency-warning strong {
color: #dc3545;
}
@media (max-width: 768px) {
body {
padding: 1rem;
}
.header h1 {
font-size: 2rem;
}
.demo-grid {
grid-template-columns: 1fr;
}
.demo-controls {
flex-direction: column;
}
.voice-commands {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<div class="header">
<h1>๐ต ChordMe Auto-Scroll & Remote Control</h1>
<p>
Experience hands-free music performance with intelligent auto-scrolling,
remote control capabilities, and voice commands for seamless live sessions.
</p>
</div>
<div class="demo-grid">
<div class="demo-card">
<h3><span class="icon">๐</span> Enhanced Auto-Scroll</h3>
<p>Intelligent scrolling that adapts to your performance style with smart tempo synchronization.</p>
<ul class="feature-list">
<li><span class="checkmark">โ</span> Configurable speed (0.1x - 5.0x)</li>
<li><span class="checkmark">โ</span> Smart tempo synchronization</li>
<li><span class="checkmark">โ</span> Anticipatory scrolling</li>
<li><span class="checkmark">โ</span> Manual override detection</li>
<li><span class="checkmark">โ</span> Emergency stop (Ctrl+Alt+Esc)</li>
<li><span class="checkmark">โ</span> Smooth/instant/progressive modes</li>
</ul>
</div>
<div class="demo-card">
<h3><span class="icon">๐ฎ</span> Remote Control</h3>
<p>Control ChordMe from your smartphone, tablet, or wireless presenter remote.</p>
<ul class="feature-list">
<li><span class="checkmark">โ</span> Smartphone/tablet app</li>
<li><span class="checkmark">โ</span> QR code device pairing</li>
<li><span class="checkmark">โ</span> Presenter remote support</li>
<li><span class="checkmark">โ</span> Foot pedal integration</li>
<li><span class="checkmark">โ</span> Multi-device connections</li>
<li><span class="checkmark">โ</span> WebSocket reliability</li>
</ul>
</div>
<div class="demo-card">
<h3><span class="icon">๐ค</span> Voice Control</h3>
<p>Hands-free operation with natural voice commands in multiple languages.</p>
<ul class="feature-list">
<li><span class="checkmark">โ</span> Multi-language support</li>
<li><span class="checkmark">โ</span> Wake word detection</li>
<li><span class="checkmark">โ</span> Confidence filtering</li>
<li><span class="checkmark">โ</span> Custom commands</li>
<li><span class="checkmark">โ</span> Noise filtering</li>
<li><span class="checkmark">โ</span> Continuous listening</li>
</ul>
</div>
</div>
<div class="demo-section">
<h2>๐ Live Demo</h2>
<p>Experience the auto-scroll and remote control features in action. These controls simulate the actual ChordMe interface.</p>
<div class="demo-controls">
<button class="button" onclick="toggleAutoScroll()">๐ Toggle Auto-Scroll</button>
<button class="button" onclick="toggleRemoteControl()">๐ฎ Toggle Remote Control</button>
<button class="button" onclick="toggleVoiceControl()">๐ค Toggle Voice Control</button>
<button class="button secondary" onclick="emergencyStop()">๐จ Emergency Stop</button>
</div>
<div style="display: flex; gap: 1rem; flex-wrap: wrap; margin: 1rem 0;">
<div class="status-indicator" id="autoScrollStatus">๐ Auto-Scroll: OFF</div>
<div class="status-indicator" id="remoteControlStatus">๐ฎ Remote: OFF</div>
<div class="status-indicator" id="voiceControlStatus">๐ค Voice: OFF</div>
</div>
<div class="emergency-warning">
<strong>Emergency Stop:</strong> Press <kbd>Ctrl + Alt + Escape</kbd> or use voice command "emergency stop"
to immediately halt all auto-scroll and remote control operations.
This safety feature ensures you can always regain manual control during live performances.
</div>
</div>
<div class="demo-section">
<h2>๐ค Voice Commands</h2>
<p>Control ChordMe with natural voice commands. Supports English and Spanish out of the box.</p>
<div class="voice-commands">
<div class="command-group">
<h4>Playback</h4>
<ul>
<li>"Play" / "Start"</li>
<li>"Pause" / "Stop"</li>
<li>"Next" / "Skip"</li>
<li>"Previous" / "Back"</li>
</ul>
</div>
<div class="command-group">
<h4>Volume</h4>
<ul>
<li>"Volume up" / "Louder"</li>
<li>"Volume down" / "Quieter"</li>
<li>"Mute"</li>
</ul>
</div>
<div class="command-group">
<h4>Navigation</h4>
<ul>
<li>"Scroll up"</li>
<li>"Scroll down"</li>
<li>"Auto scroll"</li>
<li>"Emergency stop"</li>
</ul>
</div>
<div class="command-group">
<h4>Spanish / Espaรฑol</h4>
<ul>
<li>"Reproducir" / "Pausar"</li>
<li>"Siguiente" / "Anterior"</li>
<li>"Subir volumen"</li>
<li>"Parada de emergencia"</li>
</ul>
</div>
</div>
</div>
<div class="demo-section">
<h2>๐ง Integration Example</h2>
<p>Here's how easy it is to integrate these features into your ChordMe application:</p>
<div class="code-example">
import { useAutoScrollAndRemoteControl } from './hooks/useAutoScrollAndRemoteControl';
function MyChordViewer() {
const {
// Auto-scroll controls
autoScrollConfig,
updateAutoScrollConfig,
isAutoScrollActive,
handleChordChange,
// Remote control
startRemoteControl,
connectedDevices,
// Voice control
startVoiceControl,
isVoiceControlSupported,
} = useAutoScrollAndRemoteControl({
enableAutoScroll: true,
enableRemoteControl: true,
enableVoiceControl: true,
});
return (
<div>
<AutoScrollRemoteControlPanel />
<SynchronizedChordViewer
content={chordProContent}
enableAutoScroll={true}
enableRemoteControl={true}
enableVoiceControl={true}
/>
</div>
);
}
</div>
</div>
<div class="demo-section">
<h2>๐ฑ Remote Control Setup</h2>
<p>Connect your smartphone or tablet as a remote control device:</p>
<ol style="font-size: 1.1rem; line-height: 1.8;">
<li><strong>Enable Remote Control</strong> in ChordMe settings</li>
<li><strong>Scan QR code</strong> with your mobile device</li>
<li><strong>Connect</strong> to the ChordMe WebSocket server</li>
<li><strong>Start controlling</strong> playback, scrolling, and more!</li>
</ol>
<div style="text-align: center; margin: 2rem 0;">
<div style="width: 150px; height: 150px; background: #f8f9fa; border: 2px dashed #dee2e6; margin: 0 auto; display: flex; align-items: center; justify-content: center; border-radius: 8px;">
<span style="font-size: 3rem;">๐ฑ</span>
</div>
<p style="margin: 1rem 0; color: #666;"><em>QR Code would appear here when remote control is enabled</em></p>
</div>
</div>
<div class="demo-section">
<h2>๐ฏ Performance Features</h2>
<p>Designed for live performance with reliability and safety in mind:</p>
<div class="demo-grid">
<div>
<h4>๐จ Emergency Controls</h4>
<ul>
<li>Multiple emergency stop methods</li>
<li>Instant manual override detection</li>
<li>Fail-safe operation modes</li>
<li>Quick recovery mechanisms</li>
</ul>
</div>
<div>
<h4>โก Performance Optimized</h4>
<ul>
<li><50ms synchronization accuracy</li>
<li>Smooth 60fps scrolling</li>
<li>Minimal CPU usage (<5%)</li>
<li>Efficient memory management</li>
</ul>
</div>
<div>
<h4>๐ Cross-Platform</h4>
<ul>
<li>Chrome, Firefox, Safari, Edge</li>
<li>Desktop and mobile devices</li>
<li>Presenter remotes and foot pedals</li>
<li>WebHID and WebSocket support</li>
</ul>
</div>
</div>
</div>
<div style="text-align: center; margin: 3rem 0; padding: 2rem; background: white; border-radius: 12px; box-shadow: 0 2px 12px rgba(0,0,0,0.1);">
<h2 style="margin: 0 0 1rem 0; color: #007bff;">Ready to Enhance Your Performance?</h2>
<p style="margin: 0 0 2rem 0; font-size: 1.1rem; color: #666;">
Integrate these powerful features into your ChordMe application today.
</p>
<a href="https://github.com/tonybolanyo/chordme" class="button" style="margin-right: 1rem;">
๐ View Documentation
</a>
<a href="https://github.com/tonybolanyo/chordme" class="button secondary">
๐ Get Started
</a>
</div>
<script>
// Demo functionality
let autoScrollEnabled = false;
let remoteControlEnabled = false;
let voiceControlEnabled = false;
let emergencyActive = false;
function updateStatus() {
const autoScrollStatus = document.getElementById('autoScrollStatus');
const remoteControlStatus = document.getElementById('remoteControlStatus');
const voiceControlStatus = document.getElementById('voiceControlStatus');
autoScrollStatus.textContent = `๐ Auto-Scroll: ${emergencyActive ? 'EMERGENCY STOP' : (autoScrollEnabled ? 'ON' : 'OFF')}`;
autoScrollStatus.className = `status-indicator ${emergencyActive ? 'emergency' : (autoScrollEnabled ? 'active' : '')}`;
remoteControlStatus.textContent = `๐ฎ Remote: ${remoteControlEnabled ? 'ON' : 'OFF'}`;
remoteControlStatus.className = `status-indicator ${remoteControlEnabled ? 'active' : ''}`;
voiceControlStatus.textContent = `๐ค Voice: ${voiceControlEnabled ? 'ON' : 'OFF'}`;
voiceControlStatus.className = `status-indicator ${voiceControlEnabled ? 'active' : ''}`;
}
function toggleAutoScroll() {
if (emergencyActive) {
alert('Emergency stop is active. Please clear it first.');
return;
}
autoScrollEnabled = !autoScrollEnabled;
updateStatus();
if (autoScrollEnabled) {
alert('๐ต Auto-scroll enabled! The page would now scroll automatically with the music tempo.');
} else {
alert('โธ๏ธ Auto-scroll disabled.');
}
}
function toggleRemoteControl() {
remoteControlEnabled = !remoteControlEnabled;
updateStatus();
if (remoteControlEnabled) {
alert('๐ฑ Remote control server started! Other devices can now connect via QR code or WebSocket URL.');
} else {
alert('๐ Remote control server stopped.');
}
}
function toggleVoiceControl() {
if (!'webkitSpeechRecognition' in window && !'SpeechRecognition' in window) {
alert('โ Voice control is not supported in this browser. Please use Chrome, Edge, or Safari.');
return;
}
voiceControlEnabled = !voiceControlEnabled;
updateStatus();
if (voiceControlEnabled) {
alert('๐ค Voice control enabled! Try saying "play", "pause", "scroll up", or "emergency stop".');
} else {
alert('๐ Voice control disabled.');
}
}
function emergencyStop() {
emergencyActive = true;
autoScrollEnabled = false;
updateStatus();
alert('๐จ EMERGENCY STOP ACTIVATED! All auto-scroll operations have been halted. Click any toggle to clear.');
}
function clearEmergency() {
emergencyActive = false;
updateStatus();
}
// Emergency stop keyboard shortcut
document.addEventListener('keydown', function(event) {
if (event.ctrlKey && event.altKey && event.key === 'Escape') {
emergencyStop();
event.preventDefault();
}
});
// Clear emergency on any toggle
['toggleAutoScroll', 'toggleRemoteControl', 'toggleVoiceControl'].forEach(funcName => {
const originalFunc = window[funcName];
window[funcName] = function() {
if (emergencyActive && funcName === 'toggleAutoScroll') {
clearEmergency();
return;
}
return originalFunc.apply(this, arguments);
};
});
// Initialize status
updateStatus();
// Simulate real voice recognition if available
if ('webkitSpeechRecognition' in window || 'SpeechRecognition' in window) {
console.log('๐ค Voice recognition is available in this browser!');
}
</script>
</body>
</html>