-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathexample.js
More file actions
30 lines (25 loc) · 797 Bytes
/
example.js
File metadata and controls
30 lines (25 loc) · 797 Bytes
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
var LogitechMediaServer = require('./index');
var lms = new LogitechMediaServer('192.168.0.106');
var player;
var mac_address = '00:04:20:27:5f:75'; // kitchen
// Simple keypress detection
var readline = require('readline');
var rl = readline.createInterface({
input: process.stdin,
output: process.stdout
});
// Hit enter to see the player status
rl.on('line', function (cmd) {
console.log(player.inspect());
});
lms.on("registration_finished", function() {
console.log("Registration finished.");
// Find the player in the players dictionary
player = lms.players[mac_address];
console.log(player.inspect());
// For debugging/learning, output events to console.log
player.on("logitech_event", function(p) {
console.log("logitech_event", p);
});
});
lms.start();