feat: P1 — audio/video modal player + MIME detection via magic bytes (infer)
Backend: - Add infer crate for magic-byte MIME detection (<1μs per file) - New src/common/mime_detect.rs: refine_content_type() with priority magic bytes > extension > client Content-Type - Inject MIME refinement in file upload handler (after spool to temp) - Inject MIME refinement in chunked upload handler (after assembly) Frontend: - Extend isViewableFile() to include audio/* and video/* - Add createMediaViewer() to InlineViewer with <audio>/<video> controls - Blob URL pattern for authenticated streaming playback - Graceful fallback for unsupported codecs (error message + download) - CSS: video player, audio wrapper with animated icon, responsive
This commit is contained in:
@@ -212,6 +212,54 @@
|
||||
tab-size: 4;
|
||||
}
|
||||
|
||||
/* Video viewer */
|
||||
.inline-viewer-video {
|
||||
max-width: 100%;
|
||||
max-height: 100%;
|
||||
object-fit: contain;
|
||||
border-radius: 4px;
|
||||
background-color: #000;
|
||||
}
|
||||
|
||||
/* Audio viewer */
|
||||
.inline-viewer-audio-wrapper {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 24px;
|
||||
padding: 48px 32px;
|
||||
max-width: 500px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.inline-viewer-audio-icon {
|
||||
font-size: 80px;
|
||||
color: #94a3b8;
|
||||
animation: audio-pulse 2s ease-in-out infinite;
|
||||
}
|
||||
|
||||
@keyframes audio-pulse {
|
||||
0%, 100% { opacity: 0.6; transform: scale(1); }
|
||||
50% { opacity: 1; transform: scale(1.05); }
|
||||
}
|
||||
|
||||
.inline-viewer-audio-name {
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
color: #475569;
|
||||
text-align: center;
|
||||
word-break: break-word;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.inline-viewer-audio {
|
||||
width: 100%;
|
||||
max-width: 460px;
|
||||
border-radius: 8px;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
/* Responsive adjustments */
|
||||
@media (max-width: 768px) {
|
||||
.inline-viewer-content {
|
||||
|
||||
Reference in New Issue
Block a user