laravel-admin-ext/media-player

将 mediaelement 集成到 laravel-admin

v1.1 2019-12-11 02:55 UTC

This package is auto-updated.

Last update: 2024-09-17 17:19:52 UTC


README

此扩展允许您使用 mediaelement 在网格页面和显示页面播放视频或音频。

中文介绍

截图

wx20181114-010912

wx20181114-011037

安装

composer require laravel-admin-ext/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]);

捐赠

如果您觉得这个项目为您节省了时间,您可能希望支持它 ;)

-1

许可证

MIT 许可证 (MIT) 下许可。