Spaces:
Running
Running
Create a site that will allow you to select multiple files and then play each mpeg file over and over without stopping, when you click on screen it will go to the next file. Totally client processing. - Initial Deployment
Browse files- README.md +6 -4
- index.html +156 -18
- prompts.txt +1 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
colorFrom: blue
|
| 5 |
-
colorTo:
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: mpeg-player
|
| 3 |
+
emoji: 🐳
|
| 4 |
colorFrom: blue
|
| 5 |
+
colorTo: yellow
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,157 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 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>MPEG Looper</title>
|
| 7 |
+
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
+
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
|
| 9 |
+
<script src="https://unpkg.com/feather-icons"></script>
|
| 10 |
+
<style>
|
| 11 |
+
body {
|
| 12 |
+
background-color: #1a1a2e;
|
| 13 |
+
color: #e6e6e6;
|
| 14 |
+
height: 100vh;
|
| 15 |
+
overflow: hidden;
|
| 16 |
+
}
|
| 17 |
+
.video-container {
|
| 18 |
+
position: relative;
|
| 19 |
+
width: 100%;
|
| 20 |
+
height: 100%;
|
| 21 |
+
}
|
| 22 |
+
video {
|
| 23 |
+
position: absolute;
|
| 24 |
+
top: 0;
|
| 25 |
+
left: 0;
|
| 26 |
+
width: 100%;
|
| 27 |
+
height: 100%;
|
| 28 |
+
object-fit: contain;
|
| 29 |
+
}
|
| 30 |
+
.controls {
|
| 31 |
+
position: absolute;
|
| 32 |
+
bottom: 20px;
|
| 33 |
+
left: 50%;
|
| 34 |
+
transform: translateX(-50%);
|
| 35 |
+
background: rgba(0,0,0,0.7);
|
| 36 |
+
padding: 10px 20px;
|
| 37 |
+
border-radius: 20px;
|
| 38 |
+
display: flex;
|
| 39 |
+
gap: 15px;
|
| 40 |
+
align-items: center;
|
| 41 |
+
z-index: 10;
|
| 42 |
+
}
|
| 43 |
+
.file-input {
|
| 44 |
+
display: none;
|
| 45 |
+
}
|
| 46 |
+
.btn {
|
| 47 |
+
background: #4a4a8a;
|
| 48 |
+
color: white;
|
| 49 |
+
border: none;
|
| 50 |
+
padding: 8px 16px;
|
| 51 |
+
border-radius: 20px;
|
| 52 |
+
cursor: pointer;
|
| 53 |
+
display: flex;
|
| 54 |
+
align-items: center;
|
| 55 |
+
gap: 8px;
|
| 56 |
+
transition: all 0.3s ease;
|
| 57 |
+
}
|
| 58 |
+
.btn:hover {
|
| 59 |
+
background: #6a6aaa;
|
| 60 |
+
}
|
| 61 |
+
.status {
|
| 62 |
+
font-size: 14px;
|
| 63 |
+
color: #aaa;
|
| 64 |
+
}
|
| 65 |
+
.fullscreen {
|
| 66 |
+
position: absolute;
|
| 67 |
+
top: 0;
|
| 68 |
+
left: 0;
|
| 69 |
+
width: 100%;
|
| 70 |
+
height: 100%;
|
| 71 |
+
z-index: 5;
|
| 72 |
+
}
|
| 73 |
+
</style>
|
| 74 |
+
</head>
|
| 75 |
+
<body class="font-sans">
|
| 76 |
+
<div class="video-container">
|
| 77 |
+
<video id="videoPlayer" loop></video>
|
| 78 |
+
<div class="fullscreen" id="clickArea"></div>
|
| 79 |
+
|
| 80 |
+
<div class="controls">
|
| 81 |
+
<button id="selectFilesBtn" class="btn">
|
| 82 |
+
<i data-feather="folder"></i>
|
| 83 |
+
Select Files
|
| 84 |
+
</button>
|
| 85 |
+
<span id="status" class="status">No files selected</span>
|
| 86 |
+
<input type="file" id="fileInput" class="file-input" accept="video/mpeg,.mpeg,.mpg" multiple>
|
| 87 |
+
</div>
|
| 88 |
+
</div>
|
| 89 |
+
|
| 90 |
+
<script>
|
| 91 |
+
document.addEventListener('DOMContentLoaded', () => {
|
| 92 |
+
feather.replace();
|
| 93 |
+
|
| 94 |
+
const fileInput = document.getElementById('fileInput');
|
| 95 |
+
const selectFilesBtn = document.getElementById('selectFilesBtn');
|
| 96 |
+
const videoPlayer = document.getElementById('videoPlayer');
|
| 97 |
+
const status = document.getElementById('status');
|
| 98 |
+
const clickArea = document.getElementById('clickArea');
|
| 99 |
+
|
| 100 |
+
let files = [];
|
| 101 |
+
let currentFileIndex = 0;
|
| 102 |
+
|
| 103 |
+
selectFilesBtn.addEventListener('click', () => {
|
| 104 |
+
fileInput.click();
|
| 105 |
+
});
|
| 106 |
+
|
| 107 |
+
fileInput.addEventListener('change', (e) => {
|
| 108 |
+
files = Array.from(e.target.files);
|
| 109 |
+
if (files.length > 0) {
|
| 110 |
+
status.textContent = `${files.length} files selected`;
|
| 111 |
+
playFile(0);
|
| 112 |
+
}
|
| 113 |
+
});
|
| 114 |
+
|
| 115 |
+
clickArea.addEventListener('click', () => {
|
| 116 |
+
if (files.length > 0) {
|
| 117 |
+
currentFileIndex = (currentFileIndex + 1) % files.length;
|
| 118 |
+
playFile(currentFileIndex);
|
| 119 |
+
}
|
| 120 |
+
});
|
| 121 |
+
|
| 122 |
+
function playFile(index) {
|
| 123 |
+
if (index >= 0 && index < files.length) {
|
| 124 |
+
const file = files[index];
|
| 125 |
+
const fileURL = URL.createObjectURL(file);
|
| 126 |
+
|
| 127 |
+
videoPlayer.src = fileURL;
|
| 128 |
+
videoPlayer.load();
|
| 129 |
+
|
| 130 |
+
videoPlayer.addEventListener('canplay', () => {
|
| 131 |
+
videoPlayer.play().catch(e => {
|
| 132 |
+
console.error('Autoplay prevented:', e);
|
| 133 |
+
});
|
| 134 |
+
status.textContent = `Playing ${index + 1}/${files.length}: ${file.name}`;
|
| 135 |
+
});
|
| 136 |
+
|
| 137 |
+
videoPlayer.addEventListener('ended', () => {
|
| 138 |
+
videoPlayer.currentTime = 0;
|
| 139 |
+
videoPlayer.play();
|
| 140 |
+
});
|
| 141 |
+
}
|
| 142 |
+
}
|
| 143 |
+
|
| 144 |
+
// Handle fullscreen
|
| 145 |
+
clickArea.addEventListener('dblclick', () => {
|
| 146 |
+
if (videoPlayer.requestFullscreen) {
|
| 147 |
+
videoPlayer.requestFullscreen();
|
| 148 |
+
} else if (videoPlayer.webkitRequestFullscreen) {
|
| 149 |
+
videoPlayer.webkitRequestFullscreen();
|
| 150 |
+
} else if (videoPlayer.msRequestFullscreen) {
|
| 151 |
+
videoPlayer.msRequestFullscreen();
|
| 152 |
+
}
|
| 153 |
+
});
|
| 154 |
+
});
|
| 155 |
+
</script>
|
| 156 |
+
</body>
|
| 157 |
</html>
|
prompts.txt
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
Create a site that will allow you to select multiple files and then play each mpeg file over and over without stopping, when you click on screen it will go to the next file. Totally client processing.
|