xiaohongshu
xiaohongshu
managing-media
Implements media and file management components including file upload (drag-drop, multi-file, resumable), image galleries (lightbox, carousel, masonry), video players (custom controls, captions, adaptive streaming), audio players (waveform, playlists), document viewers (PDF, Office), and optimiza...
Full skill instructions
This skill provides systematic patterns for implementing media and file management components across all formats (images, videos, audio, documents). It covers upload workflows, display patterns, player controls, optimization strategies, and accessibility requirements to ensure performant, accessible, and user-friendly media experiences.
Activate this skill when:
Select implementation based on media type and requirements:
Images → Gallery pattern + lazy loading + responsive srcset
Videos → Player with controls + captions + adaptive streaming
Audio → Player with waveform + playlist support
Documents (PDF) → Viewer with navigation + search + download
File Upload (<10MB) → Basic drag-drop with preview
File Upload (>10MB) → Chunked upload with progress + resume
Multiple Files → Queue management + parallel uploads
For detailed selection criteria, reference references/implementation-guide.md.
For small files with simple requirements:
references/upload-patterns.mdExample: examples/basic-upload.tsx
For large files requiring reliability:
references/advanced-upload.mdExample: examples/chunked-upload.tsx
For image files with editing requirements:
references/image-upload.mdExample: examples/image-upload-crop.tsx
For collections of images:
references/gallery-patterns.mdExample: examples/image-gallery.tsx
For sequential image display:
references/carousel-patterns.mdExample: examples/carousel.tsx
Essential optimization strategies:
srcset and sizesreferences/image-optimization.mdFor custom video playback:
references/video-player.mdExample: examples/video-player.tsx
Performance strategies for video:
metadata, auto, none)references/video-optimization.mdFor audio playback:
references/audio-player.mdExample: examples/audio-player.tsx
For PDF document display:
references/pdf-viewer.mdExample: examples/pdf-viewer.tsx
For DOCX, XLSX, PPTX files:
references/office-viewer.mdValidate client-side before upload:
# Generate optimized image set
python scripts/optimize_images.py --input image.jpg --formats webp,jpg,avif
Strategies:
srcset for device targetingReference references/performance-optimization.md for complete guide.
Strategies:
Essential patterns:
alt="") for decorative images<figure> and <figcaption> for contextreferences/accessibility-images.mdEssential patterns:
references/accessibility-video.mdEssential patterns:
references/accessibility-audio.mdTo validate accessibility:
node scripts/validate_media_accessibility.js
For complete requirements, reference references/accessibility-patterns.md.
Best for feature-complete galleries:
npm install react-image-gallery
See examples/gallery-react-image.tsx for implementation.
Reference /xiaolin/react-image-gallery for documentation.
Alternative: LightGallery (more features, larger bundle)
Best for custom video players:
npm install video.js
See examples/video-js-player.tsx for implementation.
Best for waveform visualization:
npm install wavesurfer.js
See examples/audio-waveform.tsx for implementation.
Best for PDF rendering in React:
npm install react-pdf
See examples/pdf-react.tsx for implementation.
For detailed comparison, reference references/library-comparison.md.
All media components use the design-tokens skill for theming:
Supports light, dark, high-contrast, and custom themes. Reference the design-tokens skill for theme switching.
Example token usage:
.upload-zone {
border: var(--upload-zone-border);
background: var(--upload-zone-bg);
padding: var(--upload-zone-padding);
border-radius: var(--upload-zone-border-radius);
}
.image-gallery {
gap: var(--gallery-gap);
}
.video-player {
background: var(--video-player-bg);
border-radius: var(--video-border-radius);
}
Four responsive approaches:
See examples/responsive-gallery.tsx for implementations.
Responsive considerations:
Reference references/responsive-media.md for patterns.
For AWS S3, Cloudinary, etc.:
Benefits:
See examples/s3-direct-upload.tsx for implementation.
Reference references/cloud-storage.md for setup.
Generate mock media:
# Generate test images
python scripts/generate_mock_images.py --count 50 --sizes thumb,medium,large
# Generate test video metadata
python scripts/generate_video_metadata.py --duration 300
Validate media accessibility:
node scripts/validate_media_accessibility.js
Analyze performance:
node scripts/analyze_media_performance.js --files images/*.jpg
Start with the example matching the requirements:
basic-upload.tsx # Simple drag-drop upload
chunked-upload.tsx # Large file upload with resume
image-upload-crop.tsx # Image upload with cropping
image-gallery.tsx # Grid gallery with lightbox
carousel.tsx # Image carousel/slider
video-player.tsx # Custom video player
audio-player.tsx # Audio player with controls
audio-waveform.tsx # Audio with waveform visualization
pdf-viewer.tsx # PDF document viewer
s3-direct-upload.tsx # Direct upload to S3
responsive-gallery.tsx # Responsive image gallery patterns
scripts/optimize_images.py - Batch image optimizationscripts/generate_mock_images.py - Test image generationscripts/validate_media_accessibility.js - Accessibility validationscripts/analyze_media_performance.js - Performance analysisreferences/upload-patterns.md - File upload implementationsreferences/gallery-patterns.md - Image gallery designsreferences/video-player.md - Video player featuresreferences/audio-player.md - Audio player patternsreferences/pdf-viewer.md - Document viewer setupreferences/accessibility-patterns.md - Media accessibilityreferences/performance-optimization.md - Optimization strategiesreferences/cloud-storage.md - Cloud integration guidesreferences/library-comparison.md - Library analysisexamples/ directory for working implementationsassets/upload-config.json - Upload constraints and settingsassets/media-templates/ - Placeholder images and iconsThis skill works with other component skills:
xiaohongshu
technical spec
product ux expert
database patterns
Conduct multi-agent task orchestration and workflow coordination.
Initialize project with Conductor artifacts (product definition,
Expert in web animations, transitions, and motion design using Framer Motion and CSS
Creates Mermaid and ASCII diagrams for flowcharts, architecture, ERDs, state machines, mindmaps, and more. Use when user mentions diagram, flowchart, mermaid, ASCII diagram, text diagram, terminal diagram, visualize, C4, mindmap, architecture diagram, sequence diagram, ERD, or needs visual docume...
PostgreSQL bindings for H3 hexagonal grid system. Use when working with H3 cells in Postgres, including spatial indexing, geometry/geography integration, and raster analysis.
Context-Driven Development skill for projects using Conductor. Use this skill when you detect a `conductor/` directory in the project, when working on tasks defined in a `plan.md` file, or when the user asks about tracks, specs, or plans. Automatically applies TDD workflow, tracks task completion...
Display project status, active tracks, and next actions
Official Stakpak application containerization standard operating procedure, a step-by-step guidline to properly dockerize applications. This is a rule book curated by the Stakpak Team.
Generate, edit, and beat-sync AI video with leading models in one workspace.
The world's fastest calendar for remote work
Transform Your Design with AI Designer by ImgCreator.ai
Revolutionizing Video Production with AI-Powered Creativity
Extend an image past the frame and let AI fill the new aspect ratio.
Discover your celebrity doppelgänger with StarByFace!
ChainClarity explains 700+ crypto whitepapers in plain English, with layered summaries, comparisons, research tools, alerts, and a $4.99 Pro plan.
Opus.ai: Revolutionize Your Web Experience