diff options
author | dakkar <dakkar@thenautilus.net> | 2021-11-28 15:21:34 +0000 |
---|---|---|
committer | dakkar <dakkar@thenautilus.net> | 2021-11-28 15:21:34 +0000 |
commit | 10f2744658eeb4ccbf0342d707c08ecfb9623b91 (patch) | |
tree | c4933340cc82e6536bccf5622bc6873855a20d23 /vlc.html | |
parent | very rought start (diff) | |
download | media-control-10f2744658eeb4ccbf0342d707c08ecfb9623b91.tar.gz media-control-10f2744658eeb4ccbf0342d707c08ecfb9623b91.tar.bz2 media-control-10f2744658eeb4ccbf0342d707c08ecfb9623b91.zip |
move stuff around, add lirc client
Diffstat (limited to 'vlc.html')
-rw-r--r-- | vlc.html | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/vlc.html b/vlc.html deleted file mode 100644 index e33ac9a..0000000 --- a/vlc.html +++ /dev/null @@ -1,58 +0,0 @@ -<!DOCTYPE html> -<html lang="en"> - <head> - <meta http-equiv="content-type" content="text/html; charset=utf-8"> - <title>vlc</title> - <script> - "use strict" - - function vlcCall(method,path,args) { - args ||= {}; - let url=new URL(path,location.href); - for (let a in args) { - url.searchParams.set(a,args[a]); - } - return fetch(url, { - method: method, - mode: 'no-cors', - }); - } - - function vlcCommand(command,args) { - vlcCall('post',command,args); - } - - async function updateView() { - const status = (await (await vlcCall('get','status')).json()).status; - const currentPos = document.querySelector('#current-pos'); - - if (status.state != 'playing') { - currentPos.disabled=true; - return; - } - - currentPos.disabled=false; - const length = parseInt(status.length); - - if (!length) { return } - - const time = parseInt(status.time); - currentPos.max=length; - currentPos.value=time; - } - - document.addEventListener('readystatechange', (event) => { - if (document.readyState == 'complete') { - setInterval(updateView, 1000); - } - }) - </script> - </head> - <body> - <button onclick="vlcCommand('play')">play</button> - <button onclick="vlcCommand('pause')">pause</button> - <button onclick="vlcCommand('stop')">stop</button> - <button onclick="updateView()">update</button> - <input type="range" id="current-pos"> - </body> -</html> |