Favicon added maybe more idk

This commit is contained in:
Jan 2024-04-23 17:24:50 +02:00
parent 05d0200275
commit b14bc2d608
10 changed files with 192 additions and 85 deletions

View File

@ -2,7 +2,7 @@ import sys
import json
import random
import base64
from flask import Flask, redirect, url_for, request, session, make_response, jsonify
from flask import Flask, redirect, url_for, request, session, make_response, jsonify, send_from_directory
from flask import render_template
from flask_sqlalchemy import SQLAlchemy
from sqlalchemy.orm import DeclarativeBase
@ -225,3 +225,5 @@ def delete_all_entries():
@app.route("/")
def blank():
return "blank page"

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@ -8,13 +8,22 @@ body {
font-size: 16px;
}
.spacer {
clear: both;
box-sizing: border-box;
}
.buttondisable {
filter: invert(65%);
}
.videocontrols {
width: 100px; /* Set a specific width for the buttons */
height: 70px; /* Set a specific height for the buttons */
background-color: #cae4ff;
border: none;
border: none;
color: white;
padding: 10px 20px;
margin: 0 10px;
border-radius: 5px;
cursor: pointer;
@ -22,6 +31,17 @@ body {
display: inline-flex; /* Display button contents as a flexbox */
justify-content: center; /* Center contents horizontally */
align-items: center; /* Center contents vertically */
text-align: center;
}
.videocontrols img {
max-width: 65%;
max-height: 65%;
text-align: center;
margin: auto;
width: auto; /* Make the image fill its container */
height: auto; /* Make the image fill its container */
display: block; /* Remove any extra space around the image */
}
.columncontainer {
@ -106,7 +126,7 @@ input, label {
}
.likert input:focus + span {
outline: -webkit-focus-ring-color auto 1px;
outline: auto 1px; /*-webkit-focus-ring-color*/
}
.likert span:hover {

View File

@ -0,0 +1,64 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles.css')}}"" /> <!-- styles.css {{ url_for('static', filename='styles.css')}}-->
<title>Testform</title>
<link rel="shortcut icon" href="{{ url_for('static', filename='icons/favicon.ico') }}">
</head>
<body>
<h2>Question: {{ current_question }}</h2>
{% if (videotype == "single")%} <!-- first figure out what video type we have -->
<div class="center">
<h3>Video 1</h3>
<iframe width="560" height="315" class="center" src="{{ video_url }}" title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowfullscreen></iframe>
</div>
{% elif (videotype == "pairwise")%}
<div class="columncontainer">
<div class="columnleft center">
<h3>Video 1</h3>
<iframe width="560" height="315" class="center" src="{{ video_url_left }}" title="YouTube video player"
frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowfullscreen></iframe>
</div>
<div class="columnright">
<h3>Video 2</h3>
<iframe width="560" height="315" src="{{ video_url_right }}" title="YouTube video player" frameborder="0"
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
allowfullscreen></iframe>
</div>
</div>
{% else %}
<p>Error: No Videotype could be matched or was given!</p>
{% endif %}
<form action="http://localhost:5000/send" method="post">
{% for block in config["question 1"]["blocks"] %}
{% if (config["question 1"]["blocks"][block]["type"] == "likert") %}
<div class="likercontainer">
<div class="likert">
<label><input name="likertscale" type="radio" value="1" /><span>I dont like it at all</span></label>
<label><input name="likertscale" type="radio" value="2" /><span>I dont like it</span></label>
<label><input name="likertscale" type="radio" value="3" /><span>I am indifferent</span></label>
<label><input name="likertscale" type="radio" value="4" /><span>I like it</span></label>
<label><input name="likertscale" type="radio" value="5" /><span>I like it a lot</span></label>
</div>
</div>
{% elif (config["question 1"]["blocks"][block]["type"] == "textinput") %}
<label for="feedback">Additional Feedback: </label>
<textarea id="feedback" name="feedback" rows="3" cols="30" maxlength="200"></textarea>
{% else %}
<p>Error: A block could not be loaded!</p>
{% endif %}
{% endfor %}
<p><input id="submitbutton" type = "submit" value = "submit";/></p>
</form>
</body>
</html>

View File

@ -5,6 +5,7 @@
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="styles.css" />
<title>Testform</title>
<link rel="shortcut icon" href="{{ url_for('static', filename='icons/favicon.ico') }}">
</head>
<body>

View File

@ -5,6 +5,7 @@
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles.css')}}"" /> <!-- styles.css {{ url_for('static', filename='styles.css')}}-->
<title>Testform</title>
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
</head>
<body>

View File

@ -5,6 +5,7 @@
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles.css')}}"" /> <!-- styles.css {{ url_for('static', filename='styles.css')}}-->
<title>Testform</title>
<link rel="shortcut icon" href="{{ url_for('static', filename='favicon.ico') }}">
</head>
<body>

View File

@ -6,76 +6,44 @@
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles.css')}}" />
<!-- styles.css {{ url_for('static', filename='styles.css')}}-->
<title>Testform</title>
<style>
/* Add any styling here */
.videocontrols {
border: none;
color: white;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
transition: background-color 0.3s ease;
}
.videocontrols img {
max-width: 60%;
max-height: 60%;
width: auto;
/* Make the image fill its container */
height: auto;
/* Make the image fill its container */
display: block;
/* Remove any extra space around the image */
}
</style>
<link rel="shortcut icon" href="{{ url_for('static', filename='icons/favicon.ico') }}">
</head>
<body>
<h2>Gib Feedback als Video</h2>
<div class="centertext">
<button type="button" class="videocontrols" id="buttonCamera">
<img id="buttonCameraIcon" src="{{ url_for('static', filename='icons/camera-icon.png')}}" alt="Camera Icon"
onclick="cameraButton()">
<button type="button" class="videocontrols" id="buttonCamera" onclick="cameraButton()">
<img id="buttonCameraIcon" src="{{ url_for('static', filename='icons/camera-icon.png')}}" alt="Camera Icon">
</button>
</div>
<div class="spacer" aria-hidden="true" style="height:30px"></div>
<div class="centertext">
<button type="button" class="videocontrols" id="buttonRecord" style="display:none">
<img id="buttonRecordIcon" src="{{ url_for('static', filename='icons/record-icon.png')}}" alt="Camera Icon"
onclick="recordButton()">
<button type="button" class="videocontrols" id="buttonRecord" style="display:none" onclick="recordButton()">
<img id="buttonRecordIcon" src="{{ url_for('static', filename='icons/record-icon.png')}}" alt="Camera Icon">
</button>
<button type="button" class="videocontrols" id="buttonAccept" style="display:none">
<img id="buttonAcceptIcon" src="{{ url_for('static', filename='icons/check-icon.png')}}" alt="Accept Icon"
onclick="acceptButton()">
</button>
<button type="button" class="videocontrols" id="buttonCancel" style="display:none">
<img id="buttonCancelIcon" src="{{ url_for('static', filename='icons/x-icon.png')}}" alt="Cancel Icon"
onclick="cancelButton()">
</button>
<button type="button" class="videocontrols" id="buttonDelete" style="display:none">
<img id="buttonDeleteIcon" src="{{ url_for('static', filename='icons/trash-icon.png')}}" alt="Delete Icon"
<button type="button" class="videocontrols" id="buttonDelete" style="display:none" disabled
onclick="deleteButton()">
<img id="buttonDeleteIcon" src="{{ url_for('static', filename='icons/trash-icon.png')}}" alt="Delete Icon"
class="buttondisable">
</button>
<div>
<video autoplay muted playsinline width="1280" height="720" id="videoDisplay"></video>
</div>
<div class="spacer" aria-hidden="true" style="height:15px"></div>
<div class="centertext">
<video autoplay muted playsinline width="1280" height="720" id="videoDisplay"></video>
</div>
<script>
const buttonCamera = document.getElementById('buttonCamera');
const buttonRecord = document.getElementById('buttonRecord');
const buttonAccept = document.getElementById('buttonAccept');
const buttonCancel = document.getElementById('buttonCancel');
const buttonDelete = document.getElementById('buttonRecord');
const buttonDelete = document.getElementById('buttonDelete');
const videoDisplay = document.getElementById('videoDisplay');
const buttonCameraIcon = document.getElementById('buttonCameraIcon');
const buttonRecordIcon = document.getElementById('buttonRecordIcon');
//const buttonDeleteIcon = document.getElementById('buttonDeleteIcon');
var mediaRecorder = null;
var stream = null;
let recordedVideoBlob = null;
@ -83,55 +51,89 @@
let videoAccess = false;
async function cameraButton() {
if (!videoAccess) { //TODO what happens if you dont get the device
console.log("videoAccess = false");
if (!videoAccess) { //test what happens if user doesnt give the permission
console.log("cameraButton case videoAccess = false");
// maybe a try catch block?
try {
stream = await navigator.mediaDevices.getUserMedia({
video: true,
});
} catch (error) {
//TODO when this occurs the user should get a hint to reload the page or to allow it next to the url
newerror = error
console.log("Error: ", error);
return
}
console.log("stream is active");
videoAccess = true
videoDisplay.srcObject = stream
buttonCameraIcon.src = "{{ url_for('static', filename='icons/camera-off-icon.png') }}"; //todo, not sure if this works
buttonCameraIcon.alt = "Camera-off Icon";
buttonRecord.style.display = 'inline-block';
} else {
console.log("videoAccess = true");
stream = null;
videoAccess = false
buttonCameraIcon.src = "{{ url_for('static', filename='icons/camera-icon.png') }}"; //todo, not sure if this works
buttonCameraIcon.alt = "Camera Icon";
buttonRecord.style.display = 'none';
}
console.log("camera button function ends");
}
buttonDelete.style.display = 'inline-block';
videoDisplay.style.display = 'inline-block';
function recordButton() {
if (!isRecording) {
mediaRecorder = new MediaRecorder(stream, {
mimeType: "video/webm", //could use other video format: https://www.iana.org/assignments/media-types/media-types.xhtml#video
// I probably want to change the bitrate: https://developer.mozilla.org/en-US/docs/Web/API/MediaRecorder/MediaRecorder
});
} else {
console.log("cameraButton case videoAccess = true");
stream = null;
videoAccess = false
buttonCameraIcon.src = "{{ url_for('static', filename='icons/camera-icon.png') }}"; //todo, not sure if this works
buttonCameraIcon.alt = "Camera Icon";
buttonRecord.style.display = 'none';
buttonDelete.style.display = 'none';
videoDisplay.style.display = 'none';
}
console.log("camera button function ends");
}
mediaRecorder.addEventListener("dataavailable", (event) => {
videoRecorded.src = URL.createObjectURL(event.data);
recordedVideoBlob = event.data;
});
function recordButton() {
console.log("recordButton pressed");
if (!isRecording) {
console.log("recordButton pressed case isRecording = false");
deleteButton();
buttonDelete.setAttribute("disabled", "");
buttonDeleteIcon.classList.add("buttondisable");
mediaRecorder.start();
buttonRecordIcon.src = "{{ url_for('static', filename='icons/stop-icon.png') }}";
buttonRecordIcon.alt = 'record icon';
isRecording = true;
console.log('Recording started');
} else {
console.log("recordButton pressed case isRecording = true");
mediaRecorder.stop();
buttonRecordIcon.src = "{{ url_for('static', filename='icons/record-icon.png') }}";
buttonRecordIcon.alt = 'Stop Icon';
isRecording = false;
console.log('Recording stopped');
buttonDelete.removeAttribute("disabled");
buttonDeleteIcon.classList.remove("buttondisable");
}
}
function deleteButton() {
//todo delete data
if (videoAccess)
buttonRecording.addEventListener("click", function () {
if (isRecording) {
recordingIcon.src = 'record-icon.png';
recordingIcon.alt = 'record icon';
console.log('Action started');
} else {
recordingIcon.src = 'stop-icon.png';
recordingIcon.alt = 'Stop Icon';
console.log('Action stopped');
buttonDelete.setAttribute("disabled", "");
buttonDeleteIcon.classList.add("buttondisable");
}
isRecording = !isRecording;
})
</script>
</body>

View File

@ -0,0 +1,16 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<link rel="stylesheet" type="text/css" href="{{ url_for('static', filename='styles.css')}}"" /> <!-- styles.css {{ url_for('static', filename='styles.css')}}-->
<title>Testform</title>
<link rel="shortcut icon" href="{{ url_for('static', filename='icons/favicon.ico') }}">
</head>
<body>
</body>
</html>

View File

@ -88,7 +88,7 @@
const search = new URLSearchParams({
extname: ".webm",
}).toString();
// this string is literally jsut "extname=.webm", WHY?
// this string is literally just "extname=.webm", WHY?
const url = "/api/upload/blob?" + search;