Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
399c66edfd | ||
|
|
d8eb881141 | ||
|
|
eb2b31997e | ||
|
|
1496e8cc1d | ||
|
|
3ddc00e28e | ||
|
|
2911c02f8a |
20
.htaccess
20
.htaccess
@ -1,18 +1,2 @@
|
||||
DirectoryIndex index.php index.html
|
||||
Options -Indexes
|
||||
Options -MultiViews
|
||||
|
||||
RewriteEngine On
|
||||
|
||||
# 0) Serve existing files/directories as-is
|
||||
RewriteCond %{REQUEST_FILENAME} -f [OR]
|
||||
RewriteCond %{REQUEST_FILENAME} -d
|
||||
RewriteRule ^ - [L]
|
||||
|
||||
# 1) Internal map: /page or /page/ -> /page.php (if such PHP file exists)
|
||||
RewriteCond %{REQUEST_FILENAME}.php -f
|
||||
RewriteRule ^(.+?)/?$ $1.php [L]
|
||||
|
||||
# 2) Optional: strip trailing slash for non-directories (keeps .php links working)
|
||||
RewriteCond %{REQUEST_FILENAME} !-d
|
||||
RewriteRule ^(.+)/$ $1 [R=301,L]
|
||||
php_value upload_max_filesize 64M
|
||||
php_value post_max_size 64M
|
||||
199
assets/css/custom.css
Normal file
199
assets/css/custom.css
Normal file
@ -0,0 +1,199 @@
|
||||
:root {
|
||||
--background-color: #181818;
|
||||
--surface-color: #282828;
|
||||
--surface-color-hover: #3a3a3a;
|
||||
--primary-color: #00A0F0;
|
||||
--secondary-color: #FFD700;
|
||||
--text-color: #E0E0E0;
|
||||
--text-color-dark: #181818;
|
||||
--red-color: #D93025;
|
||||
--green-color: #34A853;
|
||||
--border-color: #444;
|
||||
--border-radius: 4px;
|
||||
}
|
||||
|
||||
body {
|
||||
background-color: var(--background-color);
|
||||
color: var(--text-color);
|
||||
font-family: 'Roboto', 'Helvetica Neue', Arial, sans-serif;
|
||||
}
|
||||
|
||||
.main-header {
|
||||
background-color: var(--surface-color);
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
padding: 0.75rem 1.5rem;
|
||||
}
|
||||
|
||||
.video-panel {
|
||||
background-color: #000;
|
||||
border: 2px solid var(--border-color);
|
||||
border-radius: var(--border-radius);
|
||||
aspect-ratio: 16 / 9;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
flex-direction: column;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
transition: background-color 0.3s ease;
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.video-panel .panel-label {
|
||||
position: absolute;
|
||||
top: 10px;
|
||||
left: 10px;
|
||||
padding: 5px 10px;
|
||||
border-radius: var(--border-radius);
|
||||
font-size: 0.9rem;
|
||||
font-weight: bold;
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.video-panel .scene-content {
|
||||
font-size: 1.5rem;
|
||||
font-weight: bold;
|
||||
color: #fff;
|
||||
text-shadow: 2px 2px 4px rgba(0,0,0,0.7);
|
||||
}
|
||||
|
||||
#preview-panel .panel-label {
|
||||
background-color: var(--green-color);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#program-panel .panel-label {
|
||||
background-color: var(--red-color);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.control-panel {
|
||||
background-color: var(--surface-color);
|
||||
padding: 1rem;
|
||||
border-radius: var(--border-radius);
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.scene-list .list-group-item {
|
||||
background-color: var(--surface-color);
|
||||
color: var(--text-color);
|
||||
border-color: var(--border-color);
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.scene-list .list-group-item:hover {
|
||||
background-color: var(--surface-color-hover);
|
||||
}
|
||||
|
||||
.scene-list .list-group-item {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.scene-list .scene-name {
|
||||
flex-grow: 1;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.scene-list .remove-scene-btn {
|
||||
margin-left: 1rem;
|
||||
visibility: hidden; /* Hidden by default */
|
||||
opacity: 0;
|
||||
transition: opacity 0.2s, visibility 0.2s;
|
||||
}
|
||||
|
||||
.scene-list .list-group-item:hover .remove-scene-btn {
|
||||
visibility: visible; /* Show on hover */
|
||||
opacity: 1;
|
||||
}
|
||||
|
||||
#add-scene-btn {
|
||||
padding: 0.2rem 0.5rem;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
.scene-list .list-group-item.active {
|
||||
background-color: var(--primary-color);
|
||||
border-color: var(--primary-color);
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
.transition-controls .btn {
|
||||
font-size: 1.2rem;
|
||||
font-weight: bold;
|
||||
padding: 0.75rem 0;
|
||||
width: 120px;
|
||||
}
|
||||
|
||||
.btn-cut {
|
||||
background-color: var(--secondary-color);
|
||||
color: var(--text-color-dark);
|
||||
border: none;
|
||||
}
|
||||
.btn-cut:hover {
|
||||
background-color: #ffed4a;
|
||||
color: var(--text-color-dark);
|
||||
}
|
||||
|
||||
.btn-fade {
|
||||
background-color: #6c757d;
|
||||
color: #fff;
|
||||
border: none;
|
||||
}
|
||||
.btn-fade:hover {
|
||||
background-color: #5a6268;
|
||||
}
|
||||
|
||||
/* Modal Styles */
|
||||
.modal-overlay {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-color: rgba(0, 0, 0, 0.7);
|
||||
z-index: 1040;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.modal-dialog {
|
||||
background-color: var(--surface-color);
|
||||
color: var(--text-color);
|
||||
border-radius: var(--border-radius);
|
||||
border: 1px solid var(--border-color);
|
||||
width: 100%;
|
||||
max-width: 500px;
|
||||
}
|
||||
|
||||
.modal-content {
|
||||
background-color: transparent;
|
||||
border: none;
|
||||
}
|
||||
|
||||
.modal-header, .modal-footer {
|
||||
border-bottom-color: var(--border-color);
|
||||
border-top-color: var(--border-color);
|
||||
}
|
||||
|
||||
.modal-body .form-control, .modal-body .form-select {
|
||||
background-color: var(--background-color);
|
||||
color: var(--text-color);
|
||||
border-color: var(--border-color);
|
||||
}
|
||||
|
||||
.modal-body .form-control:focus, .modal-body .form-select:focus {
|
||||
background-color: var(--background-color);
|
||||
color: var(--text-color);
|
||||
border-color: var(--primary-color);
|
||||
box-shadow: 0 0 0 0.25rem rgba(0, 160, 240, 0.25);
|
||||
}
|
||||
|
||||
.modal-body .form-control-color {
|
||||
min-height: 38px;
|
||||
}
|
||||
431
assets/js/main.js
Normal file
431
assets/js/main.js
Normal file
@ -0,0 +1,431 @@
|
||||
document.addEventListener('DOMContentLoaded', function () {
|
||||
// UI Elements
|
||||
const sceneListEl = document.querySelector('.scene-list');
|
||||
const previewPanel = document.getElementById('preview-panel');
|
||||
const programPanel = document.getElementById('program-panel');
|
||||
const cutButton = document.getElementById('cut-button');
|
||||
|
||||
// Modal Elements
|
||||
const addSceneBtn = document.getElementById('add-scene-btn');
|
||||
const modal = document.getElementById('add-scene-modal');
|
||||
const modalCloseBtn = document.getElementById('modal-close-btn');
|
||||
const modalCancelBtn = document.getElementById('modal-cancel-btn');
|
||||
const modalSaveBtn = document.getElementById('modal-save-btn');
|
||||
const sceneNameInput = document.getElementById('scene-name-input');
|
||||
const sceneTypeSelect = document.getElementById('scene-type-select');
|
||||
|
||||
// Source settings elements
|
||||
const colorSettings = document.getElementById('source-color-group');
|
||||
const imageSettings = document.getElementById('source-image-group');
|
||||
const videoSettings = document.getElementById('source-video-group');
|
||||
const cameraSettings = document.getElementById('source-camera-group');
|
||||
const sceneColorInput = document.getElementById('scene-color-input');
|
||||
const sceneImageFileInput = document.getElementById('scene-image-file-input');
|
||||
const sceneVideoFileInput = document.getElementById('scene-video-file-input');
|
||||
|
||||
// Camera specific elements
|
||||
const cameraPermissionGroup = document.getElementById('camera-permission-group');
|
||||
const grantCameraPermissionBtn = document.getElementById('grant-camera-permission-btn');
|
||||
const cameraDeviceSelection = document.getElementById('camera-device-selection');
|
||||
const sceneCameraDeviceInput = document.getElementById('scene-camera-device-input');
|
||||
const cameraErrorMessage = document.getElementById('camera-error-message');
|
||||
|
||||
// Data Store
|
||||
let scenes = [];
|
||||
let activePreviewSceneId = null;
|
||||
let activeProgramSceneId = null;
|
||||
let sceneIdCounter = 0;
|
||||
let activeStreams = {}; // To hold references to active MediaStream objects
|
||||
let cameraPermissionGranted = false;
|
||||
|
||||
// --- STREAM MANAGEMENT ---
|
||||
function stopStream(panel) {
|
||||
const panelId = panel.id;
|
||||
if (activeStreams[panelId]) {
|
||||
activeStreams[panelId].getTracks().forEach(track => track.stop());
|
||||
delete activeStreams[panelId];
|
||||
}
|
||||
const videoEl = panel.querySelector('video');
|
||||
if (videoEl) {
|
||||
videoEl.remove();
|
||||
}
|
||||
}
|
||||
|
||||
// --- DATA MANAGEMENT ---
|
||||
function addScene(name, type, value) {
|
||||
const newScene = {
|
||||
id: sceneIdCounter++,
|
||||
name: name,
|
||||
type: type,
|
||||
value: value
|
||||
};
|
||||
scenes.push(newScene);
|
||||
renderSceneList();
|
||||
return newScene;
|
||||
}
|
||||
|
||||
function removeScene(id) {
|
||||
scenes = scenes.filter(scene => scene.id !== id);
|
||||
if (activePreviewSceneId === id) {
|
||||
clearPreview();
|
||||
}
|
||||
if (activeProgramSceneId === id) {
|
||||
clearProgram();
|
||||
}
|
||||
renderSceneList();
|
||||
}
|
||||
|
||||
function getScene(id) {
|
||||
return scenes.find(scene => scene.id === id);
|
||||
}
|
||||
|
||||
// --- UI RENDERING ---
|
||||
function renderSceneList() {
|
||||
sceneListEl.innerHTML = ''; // Clear existing list
|
||||
scenes.forEach(scene => {
|
||||
const icon = getIconForSceneType(scene.type);
|
||||
const item = document.createElement('div');
|
||||
item.className = 'list-group-item list-group-item-action';
|
||||
item.dataset.sceneId = scene.id;
|
||||
if (scene.id === activePreviewSceneId) {
|
||||
item.classList.add('active');
|
||||
}
|
||||
item.innerHTML = `
|
||||
<span class="scene-name">${icon} ${scene.name}</span>
|
||||
<button class="btn-close btn-close-white remove-scene-btn" aria-label="Remove"></button>
|
||||
`;
|
||||
sceneListEl.appendChild(item);
|
||||
});
|
||||
}
|
||||
|
||||
async function updatePreview(sceneId) {
|
||||
const scene = getScene(sceneId);
|
||||
if (!scene) return;
|
||||
|
||||
activePreviewSceneId = scene.id;
|
||||
|
||||
stopStream(previewPanel);
|
||||
previewPanel.innerHTML = '<span class="panel-label">PREVIEW</span><div class="scene-content"></div>';
|
||||
previewPanel.style.backgroundColor = '#000';
|
||||
previewPanel.style.backgroundImage = 'none';
|
||||
previewPanel.querySelector('.scene-content').textContent = scene.name;
|
||||
|
||||
switch (scene.type) {
|
||||
case 'color':
|
||||
previewPanel.style.backgroundColor = scene.value;
|
||||
break;
|
||||
case 'image':
|
||||
previewPanel.style.backgroundImage = `url('${scene.value}')`;
|
||||
break;
|
||||
case 'video':
|
||||
case 'camera':
|
||||
const video = document.createElement('video');
|
||||
video.muted = true;
|
||||
video.loop = scene.type === 'video';
|
||||
video.autoplay = true;
|
||||
video.style.width = '100%';
|
||||
video.style.height = '100%';
|
||||
video.style.objectFit = 'cover';
|
||||
|
||||
if (scene.type === 'video') {
|
||||
video.src = scene.value;
|
||||
} else { // camera
|
||||
try {
|
||||
const constraints = scene.value
|
||||
? { video: { deviceId: { exact: scene.value } } }
|
||||
: { video: true };
|
||||
const stream = await navigator.mediaDevices.getUserMedia(constraints);
|
||||
video.srcObject = stream;
|
||||
activeStreams[previewPanel.id] = stream;
|
||||
} catch (err) {
|
||||
console.error("Error accessing camera:", err);
|
||||
previewPanel.querySelector('.scene-content').textContent = 'Camera Error!';
|
||||
previewPanel.style.backgroundColor = 'red';
|
||||
return;
|
||||
}
|
||||
}
|
||||
previewPanel.querySelector('.scene-content').appendChild(video);
|
||||
break;
|
||||
default:
|
||||
previewPanel.style.backgroundColor = '#000';
|
||||
break;
|
||||
}
|
||||
renderSceneList();
|
||||
}
|
||||
|
||||
function clearPreview() {
|
||||
stopStream(previewPanel);
|
||||
activePreviewSceneId = null;
|
||||
previewPanel.innerHTML = '<span class="panel-label">PREVIEW</span><div class="scene-content">Select a Scene</div>';
|
||||
previewPanel.style.backgroundColor = '#000';
|
||||
previewPanel.style.backgroundImage = 'none';
|
||||
renderSceneList();
|
||||
}
|
||||
|
||||
function clearProgram() {
|
||||
stopStream(programPanel);
|
||||
activeProgramSceneId = null;
|
||||
programPanel.innerHTML = '<span class="panel-label">PROGRAM (ON AIR)</span><div class="scene-content"></div>';
|
||||
programPanel.style.backgroundColor = '#440000';
|
||||
programPanel.style.backgroundImage = 'none';
|
||||
}
|
||||
|
||||
function getIconForSceneType(type) {
|
||||
switch (type) {
|
||||
case 'color': return '<i class="bi bi-palette-fill"></i>';
|
||||
case 'image': return '<i class="bi bi-image-fill"></i>';
|
||||
case 'video': return '<i class="bi bi-film"></i>';
|
||||
case 'camera': return '<i class="bi bi-camera-video-fill"></i>';
|
||||
default: return '<i class="bi bi-question-circle-fill"></i>';
|
||||
}
|
||||
}
|
||||
|
||||
// --- CAMERA & DEVICE MANAGEMENT ---
|
||||
function resetCameraUI() {
|
||||
cameraPermissionGranted = false;
|
||||
if (sceneCameraDeviceInput) {
|
||||
sceneCameraDeviceInput.innerHTML = ''; // Clear dropdown
|
||||
}
|
||||
if (cameraErrorMessage) {
|
||||
cameraErrorMessage.textContent = ''; // Clear any old errors
|
||||
}
|
||||
if (cameraDeviceSelection) {
|
||||
cameraDeviceSelection.style.display = 'none'; // Hide device selector
|
||||
}
|
||||
if (cameraPermissionGroup) {
|
||||
cameraPermissionGroup.style.display = 'block'; // Show permission button
|
||||
}
|
||||
}
|
||||
|
||||
function showCameraUI() {
|
||||
if (cameraErrorMessage) {
|
||||
cameraErrorMessage.textContent = '';
|
||||
}
|
||||
if (cameraPermissionGranted) {
|
||||
if (cameraPermissionGroup) {
|
||||
cameraPermissionGroup.style.display = 'none';
|
||||
}
|
||||
if (cameraDeviceSelection) {
|
||||
cameraDeviceSelection.style.display = 'block';
|
||||
}
|
||||
} else {
|
||||
// This is the initial state, handled by resetCameraUI
|
||||
if (cameraPermissionGroup) {
|
||||
cameraPermissionGroup.style.display = 'block';
|
||||
}
|
||||
if (cameraDeviceSelection) {
|
||||
cameraDeviceSelection.style.display = 'none';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function requestCameraPermission() {
|
||||
if (!window.isSecureContext) {
|
||||
cameraErrorMessage.textContent = 'Camera access is only available over a secure HTTPS connection.';
|
||||
return;
|
||||
}
|
||||
|
||||
let stream = null;
|
||||
try {
|
||||
// First, get a stream. This is necessary to trigger the permission prompt
|
||||
// and to get the device labels.
|
||||
stream = await navigator.mediaDevices.getUserMedia({ video: true });
|
||||
|
||||
// Now that we have permission and an active stream, enumerate devices.
|
||||
const devices = await navigator.mediaDevices.enumerateDevices();
|
||||
const videoDevices = devices.filter(device => device.kind === 'videoinput');
|
||||
|
||||
sceneCameraDeviceInput.innerHTML = ''; // Clear previous options
|
||||
if (videoDevices.length === 0) {
|
||||
cameraErrorMessage.textContent = 'No camera devices were found.';
|
||||
return; // Exit if no cameras
|
||||
}
|
||||
|
||||
// Populate the dropdown
|
||||
videoDevices.forEach(device => {
|
||||
const option = document.createElement('option');
|
||||
option.value = device.deviceId;
|
||||
// Use the device label if available, otherwise a generic name
|
||||
option.textContent = device.label || `Camera ${sceneCameraDeviceInput.length + 1}`;
|
||||
sceneCameraDeviceInput.appendChild(option);
|
||||
});
|
||||
|
||||
// We have successfully populated the list, so update the UI
|
||||
cameraPermissionGranted = true;
|
||||
showCameraUI();
|
||||
|
||||
} catch (err) {
|
||||
console.error("Could not get camera permissions:", err);
|
||||
let msg = 'An unexpected error occurred.';
|
||||
if (err.name === 'NotAllowedError') {
|
||||
msg = "Camera permission was denied. You need to grant permission in your browser's site settings to use this feature.";
|
||||
} else if (err.name === 'NotFoundError') {
|
||||
msg = 'No camera was found on your device.';
|
||||
} else if (err.name === 'NotReadableError') {
|
||||
msg = 'The camera is currently in use by another application.';
|
||||
}
|
||||
cameraErrorMessage.textContent = msg;
|
||||
} finally {
|
||||
// Stop the stream that was used to get permissions and device labels.
|
||||
if (stream) {
|
||||
stream.getTracks().forEach(track => track.stop());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// --- EVENT LISTENERS ---
|
||||
|
||||
sceneListEl.addEventListener('click', (e) => {
|
||||
const target = e.target;
|
||||
const sceneItem = target.closest('.list-group-item');
|
||||
if (!sceneItem) return;
|
||||
|
||||
const sceneId = parseInt(sceneItem.dataset.sceneId, 10);
|
||||
|
||||
if (target.classList.contains('remove-scene-btn')) {
|
||||
removeScene(sceneId);
|
||||
} else {
|
||||
updatePreview(sceneId);
|
||||
}
|
||||
});
|
||||
|
||||
cutButton.addEventListener('click', () => {
|
||||
if (activePreviewSceneId === null) return;
|
||||
|
||||
const previewScene = getScene(activePreviewSceneId);
|
||||
activeProgramSceneId = previewScene.id;
|
||||
|
||||
stopStream(programPanel);
|
||||
|
||||
programPanel.innerHTML = previewPanel.innerHTML;
|
||||
programPanel.style.backgroundColor = previewPanel.style.backgroundColor;
|
||||
programPanel.style.backgroundImage = previewPanel.style.backgroundImage;
|
||||
|
||||
if (activeStreams[previewPanel.id]) {
|
||||
activeStreams[programPanel.id] = activeStreams[previewPanel.id];
|
||||
delete activeStreams[previewPanel.id];
|
||||
}
|
||||
|
||||
programPanel.querySelector('.panel-label').textContent = 'PROGRAM (ON AIR)';
|
||||
const programVideo = programPanel.querySelector('video');
|
||||
if(programVideo) {
|
||||
programVideo.muted = false;
|
||||
}
|
||||
|
||||
clearPreview();
|
||||
});
|
||||
|
||||
function showModal() {
|
||||
resetCameraUI(); // Reset camera state every time modal is opened
|
||||
modal.style.display = 'flex';
|
||||
sceneNameInput.focus();
|
||||
sceneTypeSelect.dispatchEvent(new Event('change'));
|
||||
}
|
||||
function hideModal() { modal.style.display = 'none'; }
|
||||
|
||||
addSceneBtn.addEventListener('click', showModal);
|
||||
modalCloseBtn.addEventListener('click', hideModal);
|
||||
modalCancelBtn.addEventListener('click', hideModal);
|
||||
|
||||
sceneTypeSelect.addEventListener('change', (e) => {
|
||||
const type = e.target.value;
|
||||
colorSettings.style.display = type === 'color' ? 'block' : 'none';
|
||||
imageSettings.style.display = type === 'image' ? 'block' : 'none';
|
||||
videoSettings.style.display = type === 'video' ? 'block' : 'none';
|
||||
cameraSettings.style.display = type === 'camera' ? 'block' : 'none';
|
||||
|
||||
if (type === 'camera') {
|
||||
showCameraUI();
|
||||
}
|
||||
});
|
||||
|
||||
grantCameraPermissionBtn.addEventListener('click', requestCameraPermission);
|
||||
|
||||
async function saveScene() {
|
||||
const name = sceneNameInput.value.trim();
|
||||
if (!name) {
|
||||
alert('Please enter a scene name.');
|
||||
return;
|
||||
}
|
||||
const type = sceneTypeSelect.value;
|
||||
let value;
|
||||
let file = null;
|
||||
|
||||
try {
|
||||
if (type === 'color') {
|
||||
value = sceneColorInput.value;
|
||||
} else if (type === 'camera') {
|
||||
value = sceneCameraDeviceInput.value;
|
||||
if (!value) {
|
||||
alert('Please select a camera device.');
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
if (type === 'image') {
|
||||
file = sceneImageFileInput.files[0];
|
||||
if (!file) { alert('Please select an image file.'); return; }
|
||||
} else if (type === 'video') {
|
||||
file = sceneVideoFileInput.files[0];
|
||||
if (!file) { alert('Please select a video file.'); return; }
|
||||
}
|
||||
|
||||
modalSaveBtn.disabled = true;
|
||||
modalSaveBtn.innerHTML = '<span class="spinner-border spinner-border-sm" role="status" aria-hidden="true"></span> Uploading...';
|
||||
|
||||
const formData = new FormData();
|
||||
formData.append('file', file);
|
||||
|
||||
const response = await fetch('upload.php', {
|
||||
method: 'POST',
|
||||
body: formData
|
||||
});
|
||||
|
||||
const result = await response.json();
|
||||
|
||||
if (result.success) {
|
||||
value = result.filePath;
|
||||
} else {
|
||||
throw new Error(result.error || 'Upload failed');
|
||||
}
|
||||
}
|
||||
|
||||
const newScene = addScene(name, type, value);
|
||||
updatePreview(newScene.id);
|
||||
|
||||
sceneNameInput.value = '';
|
||||
sceneColorInput.value = '#1e90ff';
|
||||
sceneImageFileInput.value = '';
|
||||
sceneVideoFileInput.value = '';
|
||||
sceneTypeSelect.value = 'color';
|
||||
|
||||
colorSettings.style.display = 'block';
|
||||
imageSettings.style.display = 'none';
|
||||
videoSettings.style.display = 'none';
|
||||
cameraSettings.style.display = 'none';
|
||||
hideModal();
|
||||
|
||||
} catch (error) {
|
||||
alert('Error: ' + error.message);
|
||||
} finally {
|
||||
modalSaveBtn.disabled = false;
|
||||
modalSaveBtn.textContent = 'Save Scene';
|
||||
}
|
||||
}
|
||||
|
||||
modalSaveBtn.addEventListener('click', saveScene);
|
||||
|
||||
// --- INITIALIZATION ---
|
||||
function initialize() {
|
||||
addScene('Starting Soon Screen', 'image', 'https://images.pexels.com/photos/1762851/pexels-photo-1762851.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1');
|
||||
addScene('Main Camera', 'camera', '');
|
||||
addScene('Promo Video', 'video', 'https://assets.mixkit.co/videos/preview/mixkit-spinning-around-the-earth-29351-large.mp4');
|
||||
addScene('Screen Share', 'color', '#006633');
|
||||
|
||||
const firstScene = getScene(0);
|
||||
if (firstScene) {
|
||||
updatePreview(firstScene.id);
|
||||
}
|
||||
}
|
||||
|
||||
initialize();
|
||||
});
|
||||
BIN
assets/uploads/images/img_690e7702877914.36415344.png
Normal file
BIN
assets/uploads/images/img_690e7702877914.36415344.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 62 KiB |
BIN
assets/uploads/videos/vid_690e77a9244553.28824953.mp4
Normal file
BIN
assets/uploads/videos/vid_690e77a9244553.28824953.mp4
Normal file
Binary file not shown.
270
index.php
270
index.php
@ -1,150 +1,142 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
@ini_set('display_errors', '1');
|
||||
@error_reporting(E_ALL);
|
||||
@date_default_timezone_set('UTC');
|
||||
|
||||
$phpVersion = PHP_VERSION;
|
||||
$now = date('Y-m-d H:i:s');
|
||||
?>
|
||||
<!doctype html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>New Style</title>
|
||||
<?php
|
||||
// Read project preview data from environment
|
||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
||||
?>
|
||||
<?php if ($projectDescription): ?>
|
||||
<!-- Meta description -->
|
||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
||||
<!-- Open Graph meta tags -->
|
||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||
<!-- Twitter meta tags -->
|
||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
||||
<?php endif; ?>
|
||||
<?php if ($projectImageUrl): ?>
|
||||
<!-- Open Graph image -->
|
||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||
<!-- Twitter image -->
|
||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
||||
<?php endif; ?>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>VMIXTER</title>
|
||||
<meta name="description" content="Web-based video switcher and live streaming studio.">
|
||||
<meta name="keywords" content="video switcher, live streaming, broadcast, web video, vmix alternative, obs alternative, scene management, live production, Built with Flatlogic Generator">
|
||||
<meta property="og:title" content="VMIXTER">
|
||||
<meta property="og:description" content="Web-based video switcher and live streaming studio.">
|
||||
<meta property="og:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? ''); ?>">
|
||||
<meta name="twitter:card" content="summary_large_image">
|
||||
<meta name="twitter:image" content="<?php echo htmlspecialchars($_SERVER['PROJECT_IMAGE_URL'] ?? ''); ?>">
|
||||
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--bg-color-start: #6a11cb;
|
||||
--bg-color-end: #2575fc;
|
||||
--text-color: #ffffff;
|
||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
||||
}
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'Inter', sans-serif;
|
||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
||||
color: var(--text-color);
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
min-height: 100vh;
|
||||
text-align: center;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
}
|
||||
body::before {
|
||||
content: '';
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
||||
animation: bg-pan 20s linear infinite;
|
||||
z-index: -1;
|
||||
}
|
||||
@keyframes bg-pan {
|
||||
0% { background-position: 0% 0%; }
|
||||
100% { background-position: 100% 100%; }
|
||||
}
|
||||
main {
|
||||
padding: 2rem;
|
||||
}
|
||||
.card {
|
||||
background: var(--card-bg-color);
|
||||
border: 1px solid var(--card-border-color);
|
||||
border-radius: 16px;
|
||||
padding: 2rem;
|
||||
backdrop-filter: blur(20px);
|
||||
-webkit-backdrop-filter: blur(20px);
|
||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
.loader {
|
||||
margin: 1.25rem auto 1.25rem;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
||||
border-top-color: #fff;
|
||||
border-radius: 50%;
|
||||
animation: spin 1s linear infinite;
|
||||
}
|
||||
@keyframes spin {
|
||||
from { transform: rotate(0deg); }
|
||||
to { transform: rotate(360deg); }
|
||||
}
|
||||
.hint {
|
||||
opacity: 0.9;
|
||||
}
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px; height: 1px;
|
||||
padding: 0; margin: -1px;
|
||||
overflow: hidden;
|
||||
clip: rect(0, 0, 0, 0);
|
||||
white-space: nowrap; border: 0;
|
||||
}
|
||||
h1 {
|
||||
font-size: 3rem;
|
||||
font-weight: 700;
|
||||
margin: 0 0 1rem;
|
||||
letter-spacing: -1px;
|
||||
}
|
||||
p {
|
||||
margin: 0.5rem 0;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
code {
|
||||
background: rgba(0,0,0,0.2);
|
||||
padding: 2px 6px;
|
||||
border-radius: 4px;
|
||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
||||
}
|
||||
footer {
|
||||
position: absolute;
|
||||
bottom: 1rem;
|
||||
font-size: 0.8rem;
|
||||
opacity: 0.7;
|
||||
}
|
||||
</style>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
|
||||
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<div class="card">
|
||||
<h1>Analyzing your requirements and generating your website…</h1>
|
||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
||||
<span class="sr-only">Loading…</span>
|
||||
|
||||
<header class="main-header d-flex justify-content-between align-items-center">
|
||||
<h1 class="h4 mb-0">VMIXTER</h1>
|
||||
<!-- Theme switcher placeholder -->
|
||||
<div>
|
||||
<i class="bi bi-moon-stars-fill"></i>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<main class="container-fluid mt-4">
|
||||
<div class="row">
|
||||
<!-- Preview Panel -->
|
||||
<div class="col-md-6">
|
||||
<div id="preview-panel" class="video-panel">
|
||||
<span class="panel-label">PREVIEW</span>
|
||||
<div class="scene-content">Select a Scene</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Program Panel -->
|
||||
<div class="col-md-6">
|
||||
<div id="program-panel" class="video-panel" style="background-color: #440000;">
|
||||
<span class="panel-label">PROGRAM (ON AIR)</span>
|
||||
<div class="scene-content">Initial Scene</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row mt-3">
|
||||
<!-- Scene List -->
|
||||
<div class="col-md-8">
|
||||
<div class="control-panel h-100">
|
||||
<div class="d-flex justify-content-between align-items-center mb-2">
|
||||
<h5 class="mb-0">Scenes</h5>
|
||||
<button id="add-scene-btn" class="btn btn-sm btn-success">
|
||||
<i class="bi bi-plus-lg"></i> Add
|
||||
</button>
|
||||
</div>
|
||||
<div class="list-group scene-list">
|
||||
<!-- Scenes will be dynamically inserted here by main.js -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Transition Controls -->
|
||||
<div class="col-md-4">
|
||||
<div class="control-panel h-100 d-flex flex-column justify-content-center align-items-center">
|
||||
<h5>Transitions</h5>
|
||||
<div class="d-flex justify-content-around w-100 mt-3 transition-controls">
|
||||
<button id="cut-button" class="btn btn-cut">CUT</button>
|
||||
<button id="fade-button" class="btn btn-fade" disabled>FADE</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
||||
</div>
|
||||
</main>
|
||||
<footer>
|
||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
||||
</footer>
|
||||
|
||||
<!-- Add Scene Modal -->
|
||||
<div id="add-scene-modal" class="modal-overlay" style="display: none;">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">Add New Scene</h5>
|
||||
<button type="button" class="btn-close btn-close-white" id="modal-close-btn"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<form id="add-scene-form">
|
||||
<div class="mb-3">
|
||||
<label for="scene-name-input" class="form-label">Scene Name</label>
|
||||
<input type="text" class="form-control" id="scene-name-input" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="scene-type-select" class="form-label">Source Type</label>
|
||||
<select class="form-select" id="scene-type-select">
|
||||
<option value="color">Solid Color</option>
|
||||
<option value="image">Image</option>
|
||||
<option value="video">Video</option>
|
||||
<option value="camera">Camera</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div id="source-color-group" class="mb-3 source-settings">
|
||||
<label for="scene-color-input" class="form-label">Background Color</label>
|
||||
<input type="color" class="form-control form-control-color" id="scene-color-input" value="#1e90ff">
|
||||
</div>
|
||||
|
||||
<div id="source-image-group" class="mb-3 source-settings" style="display: none;">
|
||||
<label for="scene-image-file-input" class="form-label">Image File</label>
|
||||
<input type="file" class="form-control" id="scene-image-file-input" accept="image/*">
|
||||
</div>
|
||||
|
||||
<div id="source-video-group" class="mb-3 source-settings" style="display: none;">
|
||||
<label for="scene-video-file-input" class="form-label">Video File</label>
|
||||
<input type="file" class="form-control" id="scene-video-file-input" accept="video/*">
|
||||
</div>
|
||||
|
||||
<div id="source-camera-group" class="mb-3 source-settings" style="display: none;">
|
||||
<div id="camera-permission-prompt" class="text-center">
|
||||
<p>Please grant camera permission to proceed.</p>
|
||||
<button type="button" id="grant-camera-permission-btn" class="btn btn-primary">Grant Permission</button>
|
||||
</div>
|
||||
<div id="camera-device-selection" style="display: none;">
|
||||
<label for="scene-camera-device-input" class="form-label">Camera Device</label>
|
||||
<select class="form-select" id="scene-camera-device-input"></select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" id="modal-cancel-btn">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" id="modal-save-btn">Save Scene</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
65
upload.php
Normal file
65
upload.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
$response = ['success' => false, 'error' => 'An unknown error occurred.'];
|
||||
|
||||
if (isset($_FILES['file'])) {
|
||||
$file = $_FILES['file'];
|
||||
|
||||
if ($file['error'] !== UPLOAD_ERR_OK) {
|
||||
$response['error'] = 'File upload error: ' . $file['error'];
|
||||
} else {
|
||||
$fileExt = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION));
|
||||
$fileMime = mime_content_type($file['tmp_name']);
|
||||
|
||||
$targetDir = '';
|
||||
$allowedTypes = [];
|
||||
$maxSize = 0;
|
||||
$prefix = '';
|
||||
|
||||
// Determine settings based on file type
|
||||
if (strpos($fileMime, 'image/') === 0) {
|
||||
$targetDir = 'assets/uploads/images/';
|
||||
$allowedTypes = ['jpg', 'jpeg', 'png', 'gif', 'webp'];
|
||||
$maxSize = 5 * 1024 * 1024; // 5 MB
|
||||
$prefix = 'img_';
|
||||
} elseif (strpos($fileMime, 'video/') === 0) {
|
||||
$targetDir = 'assets/uploads/videos/';
|
||||
$allowedTypes = ['mp4', 'webm', 'mov', 'ogv'];
|
||||
$maxSize = 50 * 1024 * 1024; // 50 MB
|
||||
$prefix = 'vid_';
|
||||
} else {
|
||||
$response['error'] = 'Unsupported file type: ' . $fileMime;
|
||||
}
|
||||
|
||||
if ($targetDir) {
|
||||
if (!is_dir($targetDir)) {
|
||||
mkdir($targetDir, 0775, true);
|
||||
}
|
||||
|
||||
if (!in_array($fileExt, $allowedTypes)) {
|
||||
$response['error'] = 'Invalid file extension. Allowed: ' . implode(', ', $allowedTypes);
|
||||
} elseif ($file['size'] > $maxSize) {
|
||||
$response['error'] = 'File is too large. Maximum size is ' . ($maxSize / 1024 / 1024) . ' MB.';
|
||||
} else {
|
||||
$fileName = preg_replace("/[^a-zA-Z0-9-_\.]/", "", basename($file['name']));
|
||||
$uniqueName = $prefix . uniqid('', true) . '.' . $fileExt;
|
||||
$targetPath = $targetDir . $uniqueName;
|
||||
|
||||
if (move_uploaded_file($file['tmp_name'], $targetPath)) {
|
||||
$response = [
|
||||
'success' => true,
|
||||
'filePath' => $targetPath
|
||||
];
|
||||
} else {
|
||||
$response['error'] = 'Failed to move uploaded file.';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$response['error'] = 'No file uploaded.';
|
||||
}
|
||||
|
||||
echo json_encode($response);
|
||||
?>
|
||||
Loading…
x
Reference in New Issue
Block a user