Spaces:
Sleeping
Sleeping
RandomPersonRR
commited on
Create index.html
Browse files- index.html +78 -0
index.html
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="UTF-8">
|
5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6 |
+
<title>FFmpeg Web Interface</title>
|
7 |
+
</head>
|
8 |
+
<body>
|
9 |
+
<h1>FFmpeg Web Interface</h1>
|
10 |
+
|
11 |
+
<!-- File Upload Section -->
|
12 |
+
<h2>Upload File</h2>
|
13 |
+
<input type="file" id="fileUpload" />
|
14 |
+
<button onclick="uploadFile()">Upload</button>
|
15 |
+
|
16 |
+
<!-- HTML Audio Player -->
|
17 |
+
<h2>Audio Player</h2>
|
18 |
+
<audio id="audioPlayer" controls></audio>
|
19 |
+
|
20 |
+
<!-- HTML Video Player -->
|
21 |
+
<h2>Video Player</h2>
|
22 |
+
<video id="videoPlayer" controls width="600"></video>
|
23 |
+
|
24 |
+
<!-- Command Input -->
|
25 |
+
<h2>Command Input</h2>
|
26 |
+
<textarea id="commandInput" rows="4" cols="50" placeholder="Enter FFmpeg commands here..."></textarea>
|
27 |
+
<button onclick="executeCommand()">Execute Command</button>
|
28 |
+
|
29 |
+
<!-- Logs Section -->
|
30 |
+
<h2>Logs</h2>
|
31 |
+
<pre id="logs"></pre>
|
32 |
+
|
33 |
+
<script>
|
34 |
+
function uploadFile() {
|
35 |
+
const fileInput = document.getElementById('fileUpload');
|
36 |
+
const file = fileInput.files[0];
|
37 |
+
if (file) {
|
38 |
+
const formData = new FormData();
|
39 |
+
formData.append('file', file);
|
40 |
+
|
41 |
+
fetch('/upload', {
|
42 |
+
method: 'POST',
|
43 |
+
body: formData
|
44 |
+
}).then(response => response.text())
|
45 |
+
.then(data => {
|
46 |
+
document.getElementById('logs').textContent = data;
|
47 |
+
const audioPlayer = document.getElementById('audioPlayer');
|
48 |
+
const videoPlayer = document.getElementById('videoPlayer');
|
49 |
+
const fileUrl = URL.createObjectURL(file);
|
50 |
+
|
51 |
+
// Display appropriate player based on file type
|
52 |
+
if (file.type.startsWith('audio/')) {
|
53 |
+
audioPlayer.src = fileUrl;
|
54 |
+
audioPlayer.style.display = 'block';
|
55 |
+
videoPlayer.style.display = 'none';
|
56 |
+
} else if (file.type.startsWith('video/')) {
|
57 |
+
videoPlayer.src = fileUrl;
|
58 |
+
videoPlayer.style.display = 'block';
|
59 |
+
audioPlayer.style.display = 'none';
|
60 |
+
}
|
61 |
+
});
|
62 |
+
}
|
63 |
+
}
|
64 |
+
|
65 |
+
function executeCommand() {
|
66 |
+
const command = document.getElementById('commandInput').value;
|
67 |
+
fetch('/execute', {
|
68 |
+
method: 'POST',
|
69 |
+
headers: { 'Content-Type': 'application/json' },
|
70 |
+
body: JSON.stringify({ command })
|
71 |
+
}).then(response => response.text())
|
72 |
+
.then(data => {
|
73 |
+
document.getElementById('logs').textContent = data;
|
74 |
+
});
|
75 |
+
}
|
76 |
+
</script>
|
77 |
+
</body>
|
78 |
+
</html>
|