Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message
Filament Media Action

Filament Media Action Laravel Package

hugomyb/filament-media-action

Filament action to preview media (video, audio, PDF, images, etc.) anywhere in your app (forms, tables, infolists, prefix/suffix). Just pass a media URL and it auto-detects the extension to render the right player/viewer.

View on GitHub
Deep Wiki
Context7

Automatically display your media (video, audio, pdf, image, ...) with an action in Filament

Frequently asked questions about Filament Media Action
How do I add a media preview action to a Filament table?
Use `MediaAction::make('label')` in your table’s `actions()` method, then pass the media URL via `->media('URL')`. The package auto-detects the file type and renders the correct player. Example: `MediaAction::make('Preview')->media($record->media_url)`.
Does this package support YouTube/Vimeo embeds?
Yes, it supports YouTube embeds (pass the full URL) and will auto-detect and render them. Vimeo requires a custom player or URL parsing via `->mediaType()` if not auto-detected. For Vimeo, use `->mediaType(MediaAction::TYPE_VIDEO)->media('VIMEO_URL')`.
Will this work with Filament v5? What’s the installation command?
Yes, it’s fully compatible with Filament v5. Install via `composer require hugomyb/filament-media-action:^5.0`. The package auto-detects your Filament version and aligns its behavior accordingly. No manual version checks are needed.
How do I handle local media files (e.g., from storage) without extensions?
Force the media type using `->mediaType()` before passing the URL. For example, `->mediaType(MediaAction::TYPE_VIDEO)->media(storage_path('video.mp4'))`. This bypasses auto-detection for unsupported local files. Always ensure MIME headers are correct for seamless playback.
Can I customize the media player UI (e.g., remove controls, add autoplay)?
Yes, use the `->options()` method to pass HTML5 media attributes. Example: `->options(['autoplay', 'muted', 'controlsList' => 'nodownload'])` for muted autoplay without download buttons. For advanced customization, publish the views and override the Blade templates.
Does this package work with Spatie Media Library or Laravel Mix?
Absolutely. Pass the media URL from Spatie (e.g., `$record->getFirstMediaUrl()`) or Laravel Mix assets directly. The package treats all URLs uniformly, so no additional integration is required. Just ensure the URL is publicly accessible.
How do I lazy-load media actions in large tables (e.g., 1000+ rows)?
Use Filament’s built-in pagination or lazy-loading for tables. The package itself doesn’t preload media—it only renders the player on demand when the action is clicked. For performance, consider adding `->preload(false)` to disable preloading large files.
What if autoplay is blocked by the browser? How can I ensure compliance?
Autoplay is muted by default to comply with browser policies. Use `->options(['autoplay', 'muted'])` for silent autoplay. For user-triggered playback, omit `autoplay` and rely on the play button. Test in Firefox/Safari, as their autoplay policies are stricter than Chrome.
Can I use this in Filament forms or infolists, not just tables?
Yes, `MediaAction` works anywhere Filament actions are supported: tables, forms, infolists, and even as suffix/prefix actions. For forms, use it in `->actions()` or `->columns()`. Example: `TextInput::make('media')->action(MediaAction::make('Preview')->media($record->media_url))`.
Are there alternatives if I need Vimeo or custom PDF viewers?
For Vimeo, use `->mediaType(MediaAction::TYPE_VIDEO)->media('VIMEO_URL')` with a custom player URL. For PDFs, the package uses a default viewer, but you can publish the views and replace the Blade template with a library like `pdf.js`. Alternatives like `laravel-media-library` offer broader format support but lack Filament integration.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
andydefer/laravel-cluster
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky