mirror of
https://github.com/radio95-rnt/RadioPlayer.git
synced 2026-07-29 15:29:14 +02:00
fix
This commit is contained in:
+12
-8
@@ -86,16 +86,19 @@ function wsSend(obj) {
|
|||||||
ws.send(JSON.stringify(obj));
|
ws.send(JSON.stringify(obj));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function gotLock() {
|
||||||
|
setTimeout(() => {
|
||||||
|
wsSend({action: "lock", "id": 0});
|
||||||
|
wsSend({action: "get_toplay"});
|
||||||
|
wsSend({action: "skipc"});
|
||||||
|
wsSend({action: "skipi"});
|
||||||
|
pollLockHeld = true;
|
||||||
|
}, 500 + (Math.random() * 1000))
|
||||||
|
}
|
||||||
|
|
||||||
function handleLockState(msg) {
|
function handleLockState(msg) {
|
||||||
if(msg[0] == true) pollLockHeld = false;
|
if(msg[0] == true) pollLockHeld = false;
|
||||||
else {
|
else gotLock();
|
||||||
setTimeout(() => {
|
|
||||||
wsSend({action: "lock", "id": 0});
|
|
||||||
wsSend({action: "get_toplay"});
|
|
||||||
wsSend({action: "skipc"});
|
|
||||||
wsSend({action: "skipi"});
|
|
||||||
}, 500 + (Math.random() * 1000))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function handleMessage(msg) {
|
function handleMessage(msg) {
|
||||||
@@ -109,6 +112,7 @@ function handleMessage(msg) {
|
|||||||
}
|
}
|
||||||
case "lock": {
|
case "lock": {
|
||||||
if(msg.error) pollLockHeld = false;
|
if(msg.error) pollLockHeld = false;
|
||||||
|
else if (msg.id == 0 && msg.data == false) gotLock();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case "rds":
|
case "rds":
|
||||||
|
|||||||
Reference in New Issue
Block a user