diff options
author | Evgeny Zinoviev <me@ch1p.io> | 2022-08-21 23:55:58 +0300 |
---|---|---|
committer | Evgeny Zinoviev <me@ch1p.io> | 2022-08-21 23:55:58 +0300 |
commit | 4f6adc157492f631a587d93773e1c9f40a852937 (patch) | |
tree | f99ca826ac28ffe1ef764414a6b89a36b05ad8bd | |
parent | e636419bd2598d9a3cfccfba21b07db68c0f53fd (diff) |
lws: cams: switch between highres/lowres
-rw-r--r-- | localwebsite/config.php | 7 | ||||
-rw-r--r-- | localwebsite/handlers/MiscHandler.php | 7 | ||||
-rw-r--r-- | localwebsite/templates-web/cams.twig | 7 |
3 files changed, 18 insertions, 3 deletions
diff --git a/localwebsite/config.php b/localwebsite/config.php index 399393c..c874055 100644 --- a/localwebsite/config.php +++ b/localwebsite/config.php @@ -60,7 +60,12 @@ return [ 'cam_hls_proto' => 'http', // bool|callable 'cam_hls_host' => '192.168.1.1', // bool|callable 'cam_list' => [ - // fill me with names + 'low' => [ + // fill me with names + ], + 'high' => [ + // fill me with names + ], ], 'vk_sms_checker' => [ diff --git a/localwebsite/handlers/MiscHandler.php b/localwebsite/handlers/MiscHandler.php index 657395e..983570f 100644 --- a/localwebsite/handlers/MiscHandler.php +++ b/localwebsite/handlers/MiscHandler.php @@ -52,7 +52,9 @@ class MiscHandler extends RequestHandler public function GET_cams() { global $config; - list($hls_debug, $video_events) = $this->input('b:hls_debug, b:video_events'); + list($hls_debug, $video_events, $high) = $this->input('b:hls_debug, b:video_events, b:high'); + + $tab = $high ? 'high' : 'low'; $hls_opts = [ 'startPosition' => -1, @@ -82,7 +84,8 @@ class MiscHandler extends RequestHandler 'hls_opts' => $hls_opts, 'hls_access_key' => $config['cam_hls_access_key'], - 'cams' => $config['cam_list'], + 'cams' => $config['cam_list'][$tab], + 'tab' => $tab, 'video_events' => $video_events ]); $this->tpl->set_title('Камеры'); diff --git a/localwebsite/templates-web/cams.twig b/localwebsite/templates-web/cams.twig index 0c61bc5..9079a52 100644 --- a/localwebsite/templates-web/cams.twig +++ b/localwebsite/templates-web/cams.twig @@ -4,6 +4,13 @@ ] } %} +<nav> + <div class="nav nav-tabs" id="nav-tab"> + <a href="/cams/" class="text-decoration-none"><button class="nav-link{% if tab == 'low' %} active{% endif %}" type="button">Low-res</button></a> + <a href="/cams/?high=1" class="text-decoration-none"><button class="nav-link{% if tab == 'high' %} active{% endif %}" type="button">High-res</button></a> + </div> +</nav> + <div id="videos" class="camfeeds"></div> {% js %} |