localwebsite upd

This commit is contained in:
Evgeny Zinoviev 2022-05-26 01:25:21 +03:00
parent e20f0ef7c9
commit b46401b5a9
3 changed files with 13 additions and 2 deletions

View File

@ -56,6 +56,8 @@ return [
'inverter.js' => 2,
],
'cam_hls_access_key' => '',
'cam_hls_proto' => 'http',
'cam_hls_host' => '192.168.1.1',
'cam_list' => [
// fill me with names

View File

@ -68,10 +68,16 @@ class MiscHandler extends RequestHandler
$hls_opts['debug'] = true;
$this->tpl->add_external_static('js', 'https://cdn.jsdelivr.net/npm/hls.js@latest');
$hls_host = is_callable($config['cam_hls_host']) ? $config['cam_hls_host']() : $config['cam_hls_host'];
$hls_proto = is_callable($config['cam_hls_proto']) ? $config['cam_hls_proto']() : $config['cam_hls_proto'];
$this->tpl->set([
'hls_host' => $config['cam_hls_host'],
'hls_host' => $hls_host,
'hls_proto' => $hls_proto,
'hls_opts' => $hls_opts,
'hls_access_key' => $config['cam_hls_access_key'],
'cams' => $config['cam_list'],
'video_events' => $video_events
]);

View File

@ -14,7 +14,10 @@ function hasFallbackSupport() {
}
function setupHls(video, name, useHls) {
var src = 'http://{{ hls_host }}/ipcam/'+name+'/live.m3u8';
var src = '{{ hls_proto }}://{{ hls_host }}/ipcam/'+name+'/live.m3u8';
{% if hls_access_key %}
src += '?access_key={{ hls_access_key }}';
{% endif %}
// hls.js is not supported on platforms that do not have Media Source Extensions (MSE) enabled.