illmy/media-player

将 mediaelement 集成到 laravel-admin

安装次数: 1,563

依赖者: 0

建议者: 0

安全性: 0

星标: 0

关注者: 0

分支: 10

语言:JavaScript

v1.3 2023-07-14 02:38 UTC

This package is auto-updated.

Last update: 2024-09-14 05:31:56 UTC


README

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

中文介绍

截图

wx20181114-010912

wx20181114-011037

安装

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) 下授权。