Download the PHP package hugomyb/filament-media-action without Composer
On this page you can find all versions of the php package hugomyb/filament-media-action. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download hugomyb/filament-media-action
More information about hugomyb/filament-media-action
Files in hugomyb/filament-media-action
Package filament-media-action
Short Description Automatically display your media (video, audio, document, image, ...) with an action
License MIT
Homepage https://github.com/hugomyb/filament-media-action
Informations about the package filament-media-action
▶️ Filament Media Action
Automatically display your media (video, audio, pdf, image, ...) with an action in Filament. The package automatically detects the media extension to display the correct player.
Examples
Installation
You can install the package via composer:
Optionally, you can publish the view using
Optionally, you can publish the translations using
Usage
Basic Usage
Like a classic Filament Action, you can use MediaAction anywhere (Forms, Tables, Infolists, Suffix and prefix, ...).
Simply provide the url of your media in the ->media()
method. The package will then automatically detect your media extension for display.
Available options
Autoplay
You can enable autoplay for video and audio by using the ->autoplay()
method.
You can also pass a closure in the method and access $record
and $mediaType
:
$mediatype
can return "youtube", "audio", "video", "image" or "pdf".
Preload
To control the preload behavior, use the ->preload() method. By default, it is set to true, which means the media will preload automatically. You can set it to false to disable preloading (this is helpful to avoid "Autoplay failed or was blocked" errors in some browsers).
Other options
You can customize the modal as you wish in the same way as a classic action (see https://filamentphp.com/docs/3.x/actions/modals).
If there is an existing record, you can access it by passing a closure to ->media()
method.
Example :
As shown in the example above, you can chain MediaActions together with ->extraModalFooterActions()
method.
Customizing the modal view
You can customize the modal view by publishing the view using :
Then, in the view, you can access :
$mediaType
: To retrieve the type of your media, which can be “youtube”, “audio”, “video”, “image” or “pdf”.$media
: To retrieve the url of your media
Supported media extensions
Type | Extensions |
---|---|
Video | mp4, avi, mov, webm |
Audio | mp3, wav, ogg, aac |
Documents | |
Image | jpg, jpeg, png, gif, bmp, svg, webp |
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
- Mayonobe Hugo
- All Contributors
License
The MIT License (MIT). Please see License File for more information.
All versions of filament-media-action with dependencies
filament/filament Version ^3.0
spatie/laravel-package-tools Version ^1.15.0