Spaces:
Running
Running
File size: 13,359 Bytes
83f8072 0e48f90 83f8072 0e48f90 bca182f 0e48f90 83f8072 0e48f90 83f8072 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 | <!doctype html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width" />
<meta name="description" content="Create unique AI ASMR videos & audio effortlessly. Explore now!" />
<title>AI ASMR Video Generator</title>
<link rel="stylesheet" href="style.css" />
</head>
<body>
<div class="container">
<div class="header-info">
<p>Learn more about AI ASMR generation. Try on <a href="https://aiasmr.one" target="_blank">aiasmr.one</a.</p>
</div>
<div class="main-interface">
<div class="input-panel">
<div class="upload-section">
<div class="upload-area" id="uploadArea">
<div class="upload-icon">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
<polyline points="17,8 12,3 7,8"></polyline>
<line x1="12" y1="3" x2="12" y2="15"></line>
</svg>
</div>
<div class="upload-text">
<p>Drop Image Here</p>
<p class="upload-or">- or -</p>
<p>Click to Upload</p>
</div>
<input type="file" id="fileInput" accept="image/*" hidden>
</div>
</div>
<div class="prompt-section">
<textarea id="promptInput" placeholder="describe the ASMR video you want to generate..." rows="3"></textarea>
</div>
<div class="action-buttons">
<button class="btn-icon" title="Upload">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
<polyline points="17,8 12,3 7,8"></polyline>
<line x1="12" y1="3" x2="12" y2="15"></line>
</svg>
</button>
<button class="btn-icon" title="Settings">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<circle cx="12" cy="12" r="3"></circle>
<path d="m12 1 3 6 6 3-6 3-3 6-3-6-6-3 6-3 3-6z"></path>
</svg>
</button>
<button class="btn-icon" title="Clear">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M3 6h18l-2 13H5L3 6z"></path>
<path d="M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"></path>
</svg>
</button>
</div>
<button class="generate-button" id="generateBtn">
Generate!
</button>
<div class="advanced-settings">
<div class="settings-header" id="settingsToggle">
<span>Advanced Settings</span>
<svg class="chevron" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polyline points="6,9 12,15 18,9"></polyline>
</svg>
</div>
<div class="settings-content" id="settingsContent" style="display: none;">
<div class="setting-item">
<label>Duration (seconds)</label>
<input type="range" min="5" max="60" value="30" class="slider">
<span class="value">30</span>
</div>
<div class="setting-item">
<label>Audio Quality</label>
<select class="select-input">
<option>Standard</option>
<option>High</option>
<option>Ultra</option>
</select>
</div>
</div>
</div>
</div>
<div class="output-panel">
<div class="video-display" id="videoDisplay">
<div class="display-placeholder">
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1">
<rect x="2" y="3" width="20" height="14" rx="2" ry="2"></rect>
<line x1="8" y1="21" x2="16" y2="21"></line>
<line x1="12" y1="17" x2="12" y2="21"></line>
</svg>
</div>
</div>
</div>
</div>
<div class="examples-section">
<div class="examples-header">
<span>Examples</span>
</div>
<div class="examples-grid" id="examplesGrid">
<!-- Examples will be generated by JavaScript -->
</div>
</div>
</div>
<script>
// Examples data array
const examples = [
{
prompt: "A hyper-realistic cinematic slow-motion close-up video of a whole, full-shaped strawberry made of gold glass, perfectly centered on a wooden cutting board. A human hand holds a sharp stainless steel knife and slices through the glass strawberry. Transparent shards scatter lightly from the cuts. ASMR slicing sounds only. Ultra-sharp macro lens, shallow depth of field, cinematic lighting. Only the hand, knife, and fruit are visible.",
title: "Glass Strawberry Cutting ASMR",
video: "https://files.wan21ai.com/home/aiasmr/blog/how-to-make-ai-asmr-videos-with-prompts/ai-asmr3.mp4"
},
{
prompt: "A hyper-realistic cinematic close-up of a whole, full-shaped [raspberry] made of blue glass. The glass fruit is perfectly centered on a wooden cutting board, glowing subtly under studio lighting. A human hand is clearly visible, holding a sharp stainless steel knife just above the fruit, ready to slice. In slow motion, the knife makes the first clean slice through the glass fruit -- the front section breaks off cleanly with delicate glass-crack sounds. Then, the knife immediately makes a second slice, cutting another piece smoothly. Transparent shards scatter lightly from both cuts. ASMR slicing sounds only -- no talking, no music. Only the hand, knife, and fruit are visible. Ultra-sharp macro lens, shallow depth of field, cinematic lighting.",
title: "Raspberry Cutting ASMR",
video: "https://files.wan21ai.com/home/aiasmr/blog/how-to-make-ai-asmr-videos-with-prompts/ai-asmr1.mp4"
}
];
// Generate examples HTML
function generateExamples() {
const examplesGrid = document.getElementById('examplesGrid');
examples.forEach((example, index) => {
const exampleItem = document.createElement('div');
exampleItem.className = 'example-item';
exampleItem.setAttribute('data-prompt', example.prompt);
exampleItem.setAttribute('data-title', example.title);
exampleItem.innerHTML = `
<div class="example-content">
<div class="example-video">
<video muted preload="none" class="example-video-player" playsinline>
<source src="${example.video}" type="video/mp4">
Your browser does not support the video tag.
</video>
<div class="play-overlay">
<svg width="12" height="12" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<polygon points="5,3 19,12 5,21"></polygon>
</svg>
</div>
</div>
<div class="example-text">
<div class="example-prompt">${example.prompt}</div>
</div>
</div>
`;
examplesGrid.appendChild(exampleItem);
});
}
// Helper function to create video with CORS fallback
function createVideoWithFallback(videoUrl, isPreview = false) {
const video = document.createElement('video');
if (isPreview) {
video.muted = true;
video.preload = 'none';
video.classList.add('example-video-player');
video.setAttribute('playsinline', '');
} else {
video.controls = true;
video.preload = 'auto';
video.classList.add('result-video');
}
const source = document.createElement('source');
source.src = videoUrl;
source.type = 'video/mp4';
video.appendChild(source);
// Handle CORS errors gracefully
video.addEventListener('error', () => {
console.log('Video error, trying without CORS restrictions');
// For preview videos, just hide the error
if (isPreview) {
video.style.opacity = '0.5';
return;
}
});
return video;
}
// Initialize examples on page load
document.addEventListener('DOMContentLoaded', () => {
generateExamples();
attachExampleListeners();
});
// File upload handling
const uploadArea = document.getElementById('uploadArea');
const fileInput = document.getElementById('fileInput');
uploadArea.addEventListener('click', () => {
fileInput.click();
});
uploadArea.addEventListener('dragover', (e) => {
e.preventDefault();
uploadArea.classList.add('drag-over');
});
uploadArea.addEventListener('dragleave', () => {
uploadArea.classList.remove('drag-over');
});
uploadArea.addEventListener('drop', (e) => {
e.preventDefault();
uploadArea.classList.remove('drag-over');
const files = e.dataTransfer.files;
if (files.length > 0) {
handleFile(files[0]);
}
});
fileInput.addEventListener('change', (e) => {
if (e.target.files.length > 0) {
handleFile(e.target.files[0]);
}
});
function handleFile(file) {
if (file.type.startsWith('image/')) {
const reader = new FileReader();
reader.onload = (e) => {
uploadArea.style.backgroundImage = `url(${e.target.result})`;
uploadArea.style.backgroundSize = 'cover';
uploadArea.style.backgroundPosition = 'center';
uploadArea.classList.add('has-image');
};
reader.readAsDataURL(file);
}
}
// Generate button
document.getElementById('generateBtn').addEventListener('click', () => {
window.open('https://aiasmr.one/dashboard', '_blank');
});
// Advanced settings toggle
document.getElementById('settingsToggle').addEventListener('click', () => {
const content = document.getElementById('settingsContent');
const chevron = document.querySelector('.chevron');
if (content.style.display === 'none') {
content.style.display = 'block';
chevron.style.transform = 'rotate(180deg)';
} else {
content.style.display = 'none';
chevron.style.transform = 'rotate(0deg)';
}
});
// Attach example click listeners
function attachExampleListeners() {
document.querySelectorAll('.example-item').forEach((item, index) => {
item.addEventListener('click', () => {
const prompt = item.getAttribute('data-prompt');
const title = item.getAttribute('data-title');
const example = examples[index];
document.getElementById('promptInput').value = prompt;
// Update video display
const videoDisplay = document.getElementById('videoDisplay');
// Try different approaches for CORS issues
const createVideoElement = () => {
return `
<div class="video-preview">
<video controls preload="auto" class="result-video">
<source src="${example.video}" type="video/mp4">
Your browser does not support the video tag.
</video>
<div class="video-info">
<p>${title}</p>
<small>Example video loaded - Click play to watch</small>
</div>
</div>
`;
};
videoDisplay.innerHTML = createVideoElement();
// Force video to load and add comprehensive error handling
const video = videoDisplay.querySelector('video');
// Remove crossorigin initially, add only if needed
video.removeAttribute('crossorigin');
video.load();
video.addEventListener('error', (e) => {
console.error('Video loading error:', e);
console.log('Trying alternative loading method...');
// Try with crossorigin as fallback
if (!video.hasAttribute('crossorigin')) {
video.setAttribute('crossorigin', 'anonymous');
video.load();
return;
}
// If still fails, try use-credentials
if (video.getAttribute('crossorigin') === 'anonymous') {
video.setAttribute('crossorigin', 'use-credentials');
video.load();
return;
}
// Final fallback - provide direct link
videoDisplay.innerHTML = `
<div class="video-fallback">
<div class="video-link-container">
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1">
<polygon points="5,3 19,12 5,21"></polygon>
</svg>
<p>Video cannot be embedded due to CORS policy</p>
<a href="${example.video}" target="_blank" class="video-link-btn">
Open Video in New Tab
</a>
</div>
<div class="video-info">
<p>${title}</p>
<small>Click the link above to watch the video</small>
</div>
</div>
`;
});
video.addEventListener('loadeddata', () => {
console.log('Video loaded successfully');
});
// Add additional event listeners for debugging
video.addEventListener('loadstart', () => {
console.log('Video loading started');
});
video.addEventListener('canplay', () => {
console.log('Video can start playing');
});
// Remove previous selection
document.querySelectorAll('.example-item').forEach(el => el.classList.remove('selected'));
item.classList.add('selected');
});
});
}
// Slider value update
document.querySelectorAll('.slider').forEach(slider => {
slider.addEventListener('input', (e) => {
const valueSpan = e.target.nextElementSibling;
valueSpan.textContent = e.target.value;
});
});
</script>
</body>
</html>
|