summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEvgeny Zinoviev <me@ch1p.io>2022-05-23 17:48:34 +0300
committerEvgeny Zinoviev <me@ch1p.io>2022-05-23 17:48:34 +0300
commit503d6350921f161b258f41cea4d0ebd0b5e795fc (patch)
tree9f53619426c3f0d0ce692d12f8780bee21e6eeae
parentc538f17b5ccf93acf9a72726f301bb815bfb514b (diff)
localwebsite: cams: support hls_debug param
-rw-r--r--localwebsite/handlers/MiscHandler.php9
-rw-r--r--localwebsite/templates-web/cams.twig6
2 files changed, 10 insertions, 5 deletions
diff --git a/localwebsite/handlers/MiscHandler.php b/localwebsite/handlers/MiscHandler.php
index 314920a..61a82e0 100644
--- a/localwebsite/handlers/MiscHandler.php
+++ b/localwebsite/handlers/MiscHandler.php
@@ -52,10 +52,19 @@ class MiscHandler extends RequestHandler
public function GET_cams() {
global $config;
+ list($hls_debug) = $this->input('b:hls_debug');
+
+ $hls_opts = [
+ 'startPosition' => -1
+ ];
+ if ($hls_debug)
+ $hls_opts['debug'] = true;
+
$this->tpl->add_external_static('js', 'https://cdn.jsdelivr.net/npm/hls.js@latest');
$this->tpl->set([
'hls_host' => $config['cam_hls_host'],
+ 'hls_opts' => $hls_opts,
'cams' => $config['cam_list']
]);
$this->tpl->set_title('Камеры');
diff --git a/localwebsite/templates-web/cams.twig b/localwebsite/templates-web/cams.twig
index 2963fdb..5d25a9d 100644
--- a/localwebsite/templates-web/cams.twig
+++ b/localwebsite/templates-web/cams.twig
@@ -6,7 +6,6 @@
</nav>
<div id="videos" class="camfeeds"></div>
-<video height="300" id="video"></video>
<script>
function hasFallbackSupport() {
@@ -23,10 +22,7 @@ function setupHls(video, name, useHls) {
// This is using the built-in support of the plain video element, without using hls.js.
if (useHls) {
- var hls = new Hls({
- // debug: true,
- startPosition: -1,
- });
+ var hls = new Hls({{ hls_opts|json_encode|raw }});
hls.loadSource(src);
hls.attachMedia(video);
hls.on(Hls.Events.MEDIA_ATTACHED, function () {