illmy / media-player
将 mediaelement 集成到 laravel-admin
v1.3
2023-07-14 02:38 UTC
Requires
- php: >=7.0.0
- encore/laravel-admin: ~1.6
Requires (Dev)
- phpunit/phpunit: ~6.0
This package is auto-updated.
Last update: 2024-09-14 05:31:56 UTC
README
此扩展允许您使用 mediaelement 在网格页面和显示页面播放视频或音频。
截图
安装
composer require illmy/media-player php artisan vendor:publish --tag=laravel-admin-media-player
使用方法
如果您有一个字段 foo
存储音频/视频文件的完整 URL,或者存储在 admin.upload.disk
配置的磁盘下的路径,您可以使用以下方式。
在网格页面
// Add a play button to the current field column. After clicking it will open a modal to play the video file. $grid->foo()->video(); // Add an audio player to the current field column $grid->foo()->audio();
在显示页面
// This field will be displayed as a video player $show->foo()->video(); // this field will be displayed as an audio player $show->foo()->audio();
如果字段 foo
是另一个路径或另一个服务器下的文件路径,您可以使用以下设置。
$grid->foo()->video(['server' => 'http:www.foo.com/']);
此扩展的播放器功能基于 mediaelement,可参考 API 和配置 以添加更多设置到播放器。
例如,设置播放器大小
$grid->foo()->video(['videoWidth' => 720, 'videoHeight' => 480]);
许可证
在 MIT 许可证 (MIT) 下授权。