#!/usr/bin/env node // Simple WebSocket client to test our player const WebSocket = require('ws'); const ws = new WebSocket('ws://127.0.0.1:6666'); ws.on('open', function open() { console.log('✅ Connected to video player WebSocket server'); // Test different commands setTimeout(() => { console.log('📤 Sending load video command...'); ws.send(JSON.stringify({ type: 'command', data: { type: 'loadVideo', path: '/path/to/test/video.mp4' } })); }, 1000); setTimeout(() => { console.log('📤 Sending play command...'); ws.send(JSON.stringify({ type: 'command', data: { type: 'play' } })); }, 2000); setTimeout(() => { console.log('📤 Sending volume command...'); ws.send(JSON.stringify({ type: 'command', data: { type: 'setVolume', volume: 75 } })); }, 3000); setTimeout(() => { console.log('📤 Sending pause command...'); ws.send(JSON.stringify({ type: 'command', data: { type: 'pause' } })); }, 4000); // Close after testing setTimeout(() => { console.log('🔌 Closing connection...'); ws.close(); }, 5000); }); ws.on('message', function message(data) { console.log('📥 Received:', JSON.parse(data.toString())); }); ws.on('error', function error(err) { console.log('❌ WebSocket error:', err.message); }); ws.on('close', function close() { console.log('🔌 Connection closed'); });