-
Notifications
You must be signed in to change notification settings - Fork 471
Expand file tree
/
Copy pathlinein.js
More file actions
29 lines (23 loc) · 739 Bytes
/
linein.js
File metadata and controls
29 lines (23 loc) · 739 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
'use strict';
function linein(player, values) {
const sourcePlayerName = values[0];
const altInput = values[1];
let lineinSourcePlayer = player;
if (sourcePlayerName) {
lineinSourcePlayer = player.system.getPlayer(decodeURIComponent(sourcePlayerName));
}
if (!lineinSourcePlayer) {
return Promise.reject(new Error(`Could not find player ${sourcePlayerName}`));
}
let uri
if (altInput === "spdif") {
uri = `x-sonos-htastream:${lineinSourcePlayer.uuid}:spdif`;
} else {
uri = `x-rincon-htastream:${lineinSourcePlayer.uuid}`;
}
return player.coordinator.setAVTransport(uri)
.then(() => player.coordinator.play());
}
module.exports = function (api) {
api.registerAction('linein', linein);
}