Skip to content
Projects

About

A Home Assistant front end card that can show a specific photo or video, or a sequential or randomized slide show from an entire folder structure. Full UI config with media browsing built in, plus a ton of other smart features. Also integrate with ha-media-index for metadata support and smart actions.

Design & Media

How these counts are measured

What you can do

  • 📸 Burst Review: Review rapid-fire photos taken at the same moment to select the best shot. Media Index can pre-index burst photos and the card will indicate if a photo is part of burst set and if configured replace it with a favorite from the burst set
  • 📅 Same Date: View other media items from the same date as the current photo
  • 📆 Through the Years: See photos from today's or the media item's date across all years in your library (with adjustable ±N day window)
  • 🖱️ Point-and-click file and folder selection with real image thumbnails. No more typing paths!

Measured star growth

in 24h
0
in 7 days
0
in 15 days
0
in 1 month
Collecting history

Net star changes over overlapping periods, not daily totals. Missing measurements are left blank. Stars measure attention, not software quality.

README.md

Original

Version hacs_badge

Buy Me A Coffee

HA Media Viewer Card 🎬

A powerful custom Home Assistant Dashboard card that displays images and videos with smart slideshow behavior, hierarchical folder scanning, rich metadata displays, intelligent content prioritization and TV casting support. Features include multi-level folder management, precision navigation controls, video completion detection, and a built-in media browser for easy file selection. Perfect for displaying family photos, security camera snapshots, or any media files from your Home Assistant media folders with performance optimization. 100% developed with VS Code using GitHub Copilot with Claude Sonnet 4.0/4.5/4.6.

It is highly recommended you also install the Media Index Integration that is required for many of the cool features of Media Viewer Card - Reduced scanning overhead (Media Index does this periodically instead of Media Viewer Card every time you load the card), EXIF metadata extraction, Roku Casting, favoriting, editing and deleting photos and related photos support. Also, the repo has some helpful NAS utilities for fixing videos and adding missing GPS data from related media items.

Media Viewer Card displaying a photo with metadata

✨ Key Features

Smart Media Display

  • 🎬 Mixed Media: Display images and videos together seamlessly
  • 🎯 Media Modes: Single Media and Folder modes
  • 📂 Multiple Folder Modes: Sequential or Random selection of media from folders with optional file system recursion
  • 🔄 Auto-Advance/Refresh: Configurable intervals for dynamic content
  • 🎥 Video Controls: Autoplay, loop, mute and limit video length
  • 🖼️ Aspect Ratio Control: Optimize display for any layout (panel, card, fullscreen)
  • ✨ Image Zoom: Click to zoom into any point of an image, click again to reset (configurable zoom level 1.5-5x)
  • 🎞️ Photo Transitions: Configurable crossfade transitions between images (0-1000ms) for smooth slideshow experience
  • 📱 Kiosk Mode: Automatically activate/deactivate kiosk mode (full screen) (perfect for wall-mounted tablets)
  • 🎭 Manual Fullscreen Mode: Dedicated button for immersive viewing of images (great for dashboards with small media viewer cards)
  • 🎞️ Live Photo Playback(YAML-only config beta): Pair still images with iCloud-style companion videos and play them as still → motion → pause loops

Overlay System

  • 🕐 Clock/Date Overlay: Real-time clock and date display with configurable formats (12h/24h, long/short date)
  • 📊 Display Entities: Show Home Assistant entity states as overlay with automatic rotation and fade transitions
    • Support for icons, labels, and custom styling per entity
    • Jinja2 & JavaScript template conditions and styling for dynamic visibility
    • Friendly state names for binary sensors (e.g., "Detected/Clear" for motion instead of "on/off")
    • Recent changes tracking to prioritize entities that changed recently
  • 🎨 Global Opacity Control: Single setting controls all overlay backgrounds (0-100%)
  • 📍 Flexible Positioning: 6 positions for all overlays (corners + center-top/center-bottom)

Metadata Visibility & Management with Media Index

  • ❤️ Favorite Button: 'Heart' your favorite photos and videos, with Ratings written back to photos (video ratings are in the Media Index DB only due to technical limitations)
  • ✏️ Edit and Delete Buttons: Move photos to _Edit or _Junk folders for further editing or review. Media Index provides a service to restore files in the _Edit folder to their original location.
  • 📊 Metadata Panel Button: Popup shows full image metadata, including date/time, location, camera information, and orientation (with fallback to Portrait / Landscape / Square from pixel dimensions)
  • 🏷️ Metadata Display: Selectively overlay key metadata elements - EXIF date, time and location, and folder and file name

Intelligent Navigation

  • ⏸️ Manual Queue Navigation: Manually pause/resume, group pause (hold pause button), advance forward and back in a queue.
  • ⏯️ Smart Pause/Resume: Slideshow automatically pauses when you pause a video, navigate away, or switch tabs. Resumes right where you left off when you return
  • 🌪️ Runtime Media Filter Picker: Temporarily override the card's media source, media filters video playback and auto-advance settings without changing the card's config. Filter settings propograte to all other cards using the same shared queue_id
  • 📋 Queue Preview Panel: View upcoming and previous items in your slideshow queue with thumbnail navigation. Tap an already selected item to favorite, or long-press any thumbnail to open a quick-action mini-menu: Clear from queue, Move to _Junk, or Move to _Edit
  • ⚡ Rolling Lookahead Queue: Upcoming items are silently pre-fetched in the background while the current item plays, so tapping forward is instant with no visible fetch delay
  • 🔗 Cross-Device Shared Queue: Keep multiple cards — on different views, tablets, phones, or any device — locked to the same image with shared history and pause state. Same-window sync is instant via browser events; cross-browser and cross-device sync uses Home Assistant events (requires Media Index).
  • ⌨️ Keyboard Shortcuts: Arrow keys, space, and more
  • 📲 Touch Screen Support: Swipe left/right to navigate, long-press to pause; double-tap the left or right video zone to seek ±10 s

Media Discovery Features (requires Media Index)

  • 📸 Burst Review: Review rapid-fire photos taken at the same moment to select the best shot. Media Index can pre-index burst photos and the card will indicate if a photo is part of burst set and if configured replace it with a favorite from the burst set
  • 📅 Same Date: View other media items from the same date as the current photo
  • 📆 Through the Years: See photos from today's or the media item's date across all years in your library (with adjustable ±N day window)

Advanced Capabilities

  • 🖱️ Point-and-click file and folder selection with real image thumbnails. No more typing paths!
  • 🔍 Media Index Integration: Database-backed selection with enhanced metadata
  • 🌲 Hierarchical Scanning: Handle thousands of files across nested folders efficiently with near immediate display of images
  • 🎯 Priority Folders: Boost visibility of recent photos or favorites (3x, 2x multipliers)
  • 👆 Interactive Actions: Tap, hold, and double-tap customization with optional custom confirmation messages shared queue and easily revert to card config.

📺 Media Casting to TVs (requires Media Index for Roku devices)

  • 📺 Cast Button: Tap the cast icon to open a native picker showing all media_player entities. Every time the card advances, the same item is pushed to the TV in real time.
  • Roku casting: Roku TV entities are automatically detected and cast via the XCast Receiver Channel for native image display without transcoding by the TV — no DLNA/DMR required.
    • Requirements for Roku: Roku HA integration configured, XCast Receiver Channel installed on the Roku device, and Media Index v1.8.0+
    • The XCast Receiver channel acts as a Digital Media Renderer (DMR) receiving content pushed from HA. It must be installed from the Roku Channel Store before first use. On a cold-start the card sends the image immediately to wake xcast, then retries 3s later once it has fully launched.
    • Roku Video Sync: When casting a video, the card continuously polls the Roku's playback position via ECP and corrects any drift >±2 s, keeping the local clock and the TV perfectly aligned.
    • Smooth transitions: Roku is paused immediately when the user manually navigates (no xcast banner gap) and the card waits for Roku to finish before auto-advancing to the next item.
  • Generic media players (LG WebOS DNLA DMR, Chromecast, etc.): Cast via media_player.play_media — requires the player to support DMR/HTTP URLs or have a DNLA-DMR instance installed via the DLNA-DMR integration.
  • Stop cast: Tap the cast button again or navigate away to stop. For Roku, this sends a keypress/Home ECP command so the TV returns to its home screen instead of showing a frozen image.

Installation

Install via HACS

Open in HACS

Manual Installation

  1. Download ha-media-card.js from latest release
  2. Copy to /config/www/cards/ha-media-card.js
  3. Add resource in Settings → Dashboards → Resources:
    • URL: /local/cards/ha-media-card.js
    • Type: JavaScript Module
  4. Restart Home Assistant and hard refresh browser

📚 Documentation

Getting Started

Features & Advanced Usage

Development

Built with ❤️ using GitHub Copilot + Claude Sonnet

⭐ Enjoying Media Viewer Card? Give it a star on GitHub!

📋 Special Considerations

�️ Kiosk Mode Integration

Media Viewer Card includes seamless integration with the popular Kiosk Mode HACS integration for full-screen dashboard experiences. When kiosk mode is enabled, the card provides visual hints and exit controls for a professional display setup.

🛠️ Setup Requirements

1. Install Kiosk Mode

Install the Kiosk Mode integration via HACS:

HACS → Frontend → Search "Kiosk Mode" → Install
2. Create Kiosk Mode Boolean

Add an input boolean to control kiosk mode state:

# configuration.yaml
input_boolean:
  kiosk_mode:
    name: "Kiosk Mode"
    icon: mdi:fullscreen
3. Configure Kiosk Mode

Add kiosk mode configuration to your dashboard view:

# In your dashboard view configuration
kiosk_mode:
  hide_header: '{{ is_state("input_boolean.kiosk_mode", "on") }}'
  hide_sidebar: '{{ is_state("input_boolean.kiosk_mode", "on") }}'
⚙️ Media Viewer Card Configuration

Add kiosk mode settings to your card:

type: custom:media-card
title: "Fullscreen Photo Display"
media_type: image
media_path: media-source://media_source/local/photos/
folder_mode: random
auto_refresh_seconds: 30

# Kiosk Mode Integration
kiosk_mode_entity: input_boolean.kiosk_mode
double_tap_action:
  action: toggle-kiosk
kiosk_mode_auto_enable: true
kiosk_mode_show_indicator: true

🕒 Custom Date/Time Extraction

Add support for parsing dates and times directly from your filenames and/or folder paths using simple, declarative patterns.

Configuration

Add the custom_datetime_format block to your card config. You can specify different patterns for filenames and folders. Enable debug_mode to see extraction logs in the browser console.

type: custom:media-card
debug_mode: true
custom_datetime_format:
  # Example filename formats:
  #  - "YYYY-MM-DD_HH-mm-ss"  -> 2024-12-01_14-30-45.jpg
  #  - "YYYYMMDD_HHmmss"      -> 20241201_143045.jpg
  #  - "YYYYMMDD"             -> 20241201.jpg
  filename_pattern: "YYYY-MM-DD_HH-mm-ss"

  # Example folder format:
  #  - "YYYY/MM/DD"           -> .../2024/12/01/filename.jpg
  folder_pattern: "YYYY/MM/DD"

Supported Tokens

  • YYYY: 4-digit year
  • MM: 2-digit month
  • DD: 2-digit day
  • HH: 2-digit hour (24h)
  • mm: 2-digit minute
  • ss: 2-digit second

You can use separators like -, _, /, T, or spaces to match your naming scheme.

How It Works

  • The card first attempts to parse using your custom patterns.
  • If parsing fails, it automatically falls back to the built-in filename patterns used in previous versions (no config change required).
  • If both custom and built-in parsing fail, the card will rely on EXIF data (if available via Media Index) or leave the date unset.
  • When both folder and filename patterns are configured, the folder date is used first only if it successfully parses; otherwise the filename date is used.

Debugging

Set debug_mode: true to see helpful logs in the console:

🕒 [Custom DateTime] Extracted from filename "2024-12-01_14-30-45.jpg": Sun Dec 01 2024 14:30:45
⚠️ [Custom DateTime] Failed to extract from folder "2024/12/01" with pattern "YYYY-MM-DD"
🕒 [DateTime] Extracted from filename "20220727_140134.jpg": Wed Jul 27 2022 14:01:34

No changes are required if you don't need this feature — it's fully optional and backward compatible.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

🤝 Contributing

Contributions are welcome! This project uses a modular source structure for easier development and maintenance.

Development Workflow

The card is developed under src/ as ES modules and bundled into a single ha-media-card.js file for deployment.

Quick Start:

  1. Fork the repository and clone your fork
  2. Create a branch from dev: git checkout -b feature/my-feature dev
  3. Install Node.js and dependencies: npm install
  4. Edit source files under src/:
    • src/core/ - Shared utilities and base classes
    • src/providers/ - Provider implementations
    • src/ui/ - Main card component
    • src/editor/ - Configuration editor
  5. Build: npm run build:concat (concatenation build - preserves class names)
  6. Test on your Home Assistant instance
  7. Commit changes and push to your fork
  8. Open a Pull Request against the dev branch

Important: All contributions and PRs should be based off the dev branch, not master. The master branch is reserved for stable releases only.

For detailed development guidelines, see .github/copilot-instructions.md.

🙏 Acknowledgments

  • Home Assistant community for inspiration and support
  • Lit Element for the excellent web component framework
  • All users who provide feedback and suggestions

Enjoy your new Media Viewer Card! 🎉

If you find this card useful, please consider giving it a ⭐ on GitHub!

Explore related projects

Loading…