-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
49 lines (46 loc) · 1.09 KB
/
Copy pathindex.html
File metadata and controls
49 lines (46 loc) · 1.09 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
<!DOCTYPE html>
<html>
<head>
<title>minimum web interface</title>
</head>
<body>
<p>minimum, there is very little here</p>
<span id="pause" onclick="fnPausePlayer();"><p>play/pause (click me)</p></span>
<script type="text/javascript">
//pause the player, by id.
function fnPause(iPlayerId) {
const oReq={jsonrpc:"2.0", id:1, method:"Player.PlayPause", params:{playerid: iPlayerId} }
fetch("/jsonrpc", {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(oReq)
});
}
//determine which player is active, if any. It could be Audio (0) or Video (1)
function fnPausePlayer()
{
const oReq={jsonrpc:"2.0", id:0, method:"Player.GetActivePlayers"}
fetch("/jsonrpc", {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(oReq)
})
.then((response) => {
if (!response.ok) {
throw new Error(`HTTP error, status = ${response.status}`);
}
return response.json();
})
.then((data) => {
if(data.result.length=1){
fnPause(data.result[0].playerid)
}
});
}
</script>
</body>
</html>