diff --git a/.gitignore b/.gitignore index 762556a..d572bec 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /videos/*.mp4 /videos/*.ts /videos/*.json +/docker/app \ No newline at end of file diff --git a/app/cancel.php b/app/cancel.php index 3323b6c..f0b5b6f 100644 --- a/app/cancel.php +++ b/app/cancel.php @@ -1,5 +1,6 @@ true]); + exit; +} +echo json_encode(['status' => false]); \ No newline at end of file diff --git a/app/hls-pull.php b/app/hls-pull.php index 94798be..3d35b74 100644 --- a/app/hls-pull.php +++ b/app/hls-pull.php @@ -1,5 +1,6 @@ @@ -86,6 +87,47 @@ + + + + + diff --git a/app/info.php b/app/info.php index 737d4c2..71fb80f 100644 --- a/app/info.php +++ b/app/info.php @@ -1,4 +1,5 @@ Processing a new video, have patience.
'; + html = html + '
'; + } for (row of json.list) { var link = '/info.php?id=' + row.number; html = html + '' + row.number + '' + row.date + ''; @@ -126,8 +137,13 @@ function checkList() { } html = html + ''; } - $('#result-set tbody').html(html); - setTimeout(checkList, 20000); + if (lastFetchAmount !== json.list.length || waitingForNew) { + waitingForNew = false; + $('#result-set tbody').html(html); + } + + lastFetchAmount = json.list.length; + setTimeout(checkList, 4000); }); } @@ -146,11 +162,11 @@ function checkStatus(first) { } if (json.listening === true && json.running === false && json.listening_format == 'rtmp') { activeStream(); - $('#message').html('Listening to rtmp on rtmp://' + window.location.hostname + ':6872. Please stream to this when ready.'); + $('#message').html('Listening to rtmp on rtmp://' + window.location.hostname + ':6872/test/live. Please stream to this when ready.'); } if (json.listening === true && json.running === true) { activeStream(); - $('#message').html('Currently streaming/reading. It will run for 30 seconds before we validate the stream.'); + $('#message').html('Currently streaming/reading. It will run for 30 seconds or shorter before we validate the stream.'); } if (json.listening === false && json.running === true) { activeStream(); @@ -163,6 +179,11 @@ function checkStatus(first) { $('#test-hls-pull').attr('disabled', false); $('#test-srt').attr('disabled', false); } + + if (lastStatus && !json.running) { + waitingForNew = true; + } + lastStatus = json.running; setTimeout(checkStatus, 500); }); } @@ -183,4 +204,49 @@ function nonActiveStream() { $('#test-rtmp-pull').show(); $('#test-hls-pull').show(); $('#cancel-test').hide(); +} + +function setNewCredentials() { + var credValidation = true; + $('#basic-auth-password-help').removeClass('invalid-feedback'); + $('#basic-auth-password').removeClass('is-invalid'); + $('#basic-auth-password-validate-help').removeClass('invalid-feedback'); + $('#basic-auth-password-validate-help').html(''); + $('#basic-auth-password-validate').removeClass('is-invalid'); + $('#basic-auth-password-help').html(''); + $('#basic-auth-username-help').removeClass('invalid-feedback'); + $('#basic-auth-username').removeClass('is-invalid'); + $('#basic-auth-username-help').html(''); + + if ($('#basic-auth-username').val() == '') { + credValidation = false; + $('#basic-auth-username-help').addClass('invalid-feedback'); + $('#basic-auth-username').addClass('is-invalid'); + $('#basic-auth-username-help').html('You need to fill out this'); + } + if ($('#basic-auth-password').val() == '') { + credValidation = false; + $('#basic-auth-password-help').addClass('invalid-feedback'); + $('#basic-auth-password').addClass('is-invalid'); + $('#basic-auth-password-help').html('You need to fill out this'); + } + if ($('#basic-auth-password-validate').val() == '') { + credValidation = false; + $('#basic-auth-password-validate-help').addClass('invalid-feedback'); + $('#basic-auth-password-validate').addClass('is-invalid'); + $('#basic-auth-password-validate-help').html('You need to fill out this'); + } + if ($('#basic-auth-password-validate').val() !== $('#basic-auth-password').val()) { + credValidation = false; + $('#basic-auth-password-validate-help').addClass('invalid-feedback'); + $('#basic-auth-password-validate').addClass('is-invalid'); + $('#basic-auth-password-validate-help').html('Passwords needs to match'); + } + if (credValidation == true) { + $.getJSON("/credentials.php?username=" + $('#basic-auth-username').val() + '&password=' + $('#basic-auth-password').val(), function( json ) { + if (json.status) { + $('#basicAuthModal').modal('hide'); + } + }); + } } \ No newline at end of file diff --git a/app/list.php b/app/list.php index 9c00f34..5f823c9 100644 --- a/app/list.php +++ b/app/list.php @@ -1,5 +1,7 @@ FALSE, 'running' => FALSE, @@ -16,7 +18,7 @@ } if (file_exists('/tmp/listening-rtmp-pull')) { $output['listening'] = TRUE; - $output['listening_format'] = 'rtmp'; + $output['listening_format'] = 'rtmp-pull'; } if (file_exists('/tmp/listening-hls-pull')) { $output['listening'] = TRUE; diff --git a/docker/Dockerfile b/docker/Dockerfile index 87e9b50..85bc75a 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -25,5 +25,9 @@ COPY config/app.conf /etc/apache2/sites-enabled/ RUN mkdir /videos RUN mkdir /validation-config +RUN mkdir /htpasswd +COPY config/.htpasswd /htpasswd +RUN chown -R www-data:www-data /htpasswd -COPY config/entrypoint.sh /sbin/entrypoint.sh \ No newline at end of file +COPY config/entrypoint.sh /sbin/entrypoint.sh +COPY app /var/www/app \ No newline at end of file diff --git a/docker/build.sh b/docker/build.sh index 1459b5c..3b16de6 100755 --- a/docker/build.sh +++ b/docker/build.sh @@ -1,3 +1,5 @@ #!/bin/bash +cp -r ../app ./ docker build . -t compuccino/encoder-validator:latest -docker push compuccino/encoder-validator:latest \ No newline at end of file +docker push compuccino/encoder-validator:latest +rm -rf ./app \ No newline at end of file diff --git a/docker/config/.htpasswd b/docker/config/.htpasswd new file mode 100644 index 0000000..98cc455 --- /dev/null +++ b/docker/config/.htpasswd @@ -0,0 +1 @@ +oskberlin:YWG41BPzVAkN6 \ No newline at end of file diff --git a/docker/config/app.conf b/docker/config/app.conf index cd0f461..593d056 100644 --- a/docker/config/app.conf +++ b/docker/config/app.conf @@ -10,7 +10,8 @@ AllowOverride None AddDefaultCharset utf-8 DirectoryIndex index.php - Require all granted + Order allow,deny + Allow from all RewriteEngine On @@ -29,6 +30,7 @@ - + Order allow,deny + Allow from all \ No newline at end of file diff --git a/validation-config/1080p-h264-stereo-aac-25fps-iframe50.yaml b/validation-config/1080p-h264-stereo-aac-25fps-iframe50.yaml new file mode 100644 index 0000000..4c053bf --- /dev/null +++ b/validation-config/1080p-h264-stereo-aac-25fps-iframe50.yaml @@ -0,0 +1,25 @@ +video: + format: + and: + - or: + - exact: avc + - exact: h264 + - not-exact: av1 + width: + exact: 1920 + height: + exact: 1080 + frameRate: + exact: 25 +audio: + format: + and: + - contains: aac + - not-exact: hd-aac + channelS: + exact: 2 +# Frames is a special solution with it's own rules +frames: + keyFrameDistance: + min: 50 + max: 50 \ No newline at end of file