localwebsite: cams: support hls_debug param
This commit is contained in:
parent
c538f17b5c
commit
503d635092
@ -52,10 +52,19 @@ class MiscHandler extends RequestHandler
|
|||||||
public function GET_cams() {
|
public function GET_cams() {
|
||||||
global $config;
|
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->add_external_static('js', 'https://cdn.jsdelivr.net/npm/hls.js@latest');
|
||||||
|
|
||||||
$this->tpl->set([
|
$this->tpl->set([
|
||||||
'hls_host' => $config['cam_hls_host'],
|
'hls_host' => $config['cam_hls_host'],
|
||||||
|
'hls_opts' => $hls_opts,
|
||||||
'cams' => $config['cam_list']
|
'cams' => $config['cam_list']
|
||||||
]);
|
]);
|
||||||
$this->tpl->set_title('Камеры');
|
$this->tpl->set_title('Камеры');
|
||||||
|
@ -6,7 +6,6 @@
|
|||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
<div id="videos" class="camfeeds"></div>
|
<div id="videos" class="camfeeds"></div>
|
||||||
<video height="300" id="video"></video>
|
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function hasFallbackSupport() {
|
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.
|
// This is using the built-in support of the plain video element, without using hls.js.
|
||||||
|
|
||||||
if (useHls) {
|
if (useHls) {
|
||||||
var hls = new Hls({
|
var hls = new Hls({{ hls_opts|json_encode|raw }});
|
||||||
// debug: true,
|
|
||||||
startPosition: -1,
|
|
||||||
});
|
|
||||||
hls.loadSource(src);
|
hls.loadSource(src);
|
||||||
hls.attachMedia(video);
|
hls.attachMedia(video);
|
||||||
hls.on(Hls.Events.MEDIA_ATTACHED, function () {
|
hls.on(Hls.Events.MEDIA_ATTACHED, function () {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user