lws: cams: switch between highres/lowres

This commit is contained in:
Evgeny Zinoviev 2022-08-21 23:55:58 +03:00
parent e636419bd2
commit 4f6adc1574
3 changed files with 18 additions and 3 deletions

View File

@ -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' => [

View File

@ -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('Камеры');

View File

@ -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 %}