Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Device cam and styling fixes #220

Merged
merged 5 commits into from
Feb 28, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions api/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@
$newConfig['login_password'] = NULL;
}

if (!$newConfig['previewFromCam']) {
$newConfig['previewCamTakesPic'] = false;
}

$content = "<?php\n\$config = ". var_export(arrayRecursiveDiff($newConfig, $defaultConfig), true) . ";";

if (file_put_contents($my_config_file, $content)) {
Expand Down
2 changes: 1 addition & 1 deletion api/takePic.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function takePicture($filename)
$demoFolder . $devImg[array_rand($devImg)],
$filename
);
} elseif ($config['previewCamTakesPic']) {
} elseif ($config['previewFromCam'] && $config['previewCamTakesPic']) {
$data = $_POST['canvasimg'];
list($type, $data) = explode(';', $data);
list(, $data) = explode(',', $data);
Expand Down
2 changes: 0 additions & 2 deletions index.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,7 @@
<i class="fa fa-cog fa-spin"></i>
</div>

<?php if ($config['previewFromCam']): ?>
<video id="video--view" autoplay playsinline></video>
<?php endif; ?>

<div id="counter">
<canvas id="video--sensor"</canvas>
Expand Down
18 changes: 15 additions & 3 deletions resources/js/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ const photoBooth = (function () {
gallery.find('.gallery__inner').hide();
$('.spinner').hide();
$('.send-mail').hide();
$('#video--view').hide();
$('#video--sensor').hide();
public.resetMailForm();
}

Expand Down Expand Up @@ -164,9 +166,18 @@ const photoBooth = (function () {
$('<p>').text(`${nextCollageNumber + 1} / ${config.collage_limit}`).appendTo('.cheese');
}

setTimeout(() => {
public.takePic(photoStyle);
}, config.cheese_time);
if (config.previewFromCam && config.previewCamTakesPic && !public.stream && !config.dev) {
console.log('No preview by device cam available!');

public.errorPic({
error: 'No preview by device cam available!'
});

} else {
setTimeout(() => {
public.takePic(photoStyle);
}, config.cheese_time);
}
}

// take Picture
Expand Down Expand Up @@ -247,6 +258,7 @@ const photoBooth = (function () {
$('.spinner').hide();
$('.loading').empty();
$('.cheese').empty();
$('#video--view').hide();
$('#video--sensor').hide();
loader.addClass('error');
$('.loading').append($('<p>').text(L10N.error));
Expand Down
4 changes: 4 additions & 0 deletions resources/sass/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,10 @@ input[type="email"] {
p {
margin: 0 0 0.2em;
}

.btn {
font-size: 0.4em;
}
}

.error {
Expand Down