tristantbg/kirby-mux 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

tristantbg/kirby-mux

最新稳定版本:v1.3.3

Composer 安装命令:

composer require tristantbg/kirby-mux

包简介

Upload videos directly to mux

README 文档

README

A Kirby plugin to upload video files to Mux.

Installation

Download

Download and copy this repository to /site/plugins/kirby-mux.

Git submodule

git submodule add https://github.com/tristantbg/kirby-mux.git site/plugins/kirby-mux

Composer

composer require tristantbg/kirby-mux

Configuration

Add your Mux API credentials to your Kirby config file:

// site/config/config.php
return [
  'tristantbg.kirby-mux' => [
    'tokenId' => 'XXX', // Your Mux API Access Token ID
    'tokenSecret' => 'XXX', // Your Mux API Secret Key
  ],
];

Options

Option Type Default Description
tokenId String '' Your Mux API Access Token ID
tokenSecret String '' Your Mux API Secret Key
dev Boolean false Use a test video instead of the actual upload
optimizeDiskSpace Boolean false Download the low-res MP4 locally and replace the original

Dev Mode

Set dev to true for local development. Instead of the actual video, the plugin will upload a test video to Mux. This is necessary since videos need to be publicly accessible for Mux to import them.

// site/config/config.php
return [
  'tristantbg.kirby-mux' => [
    'tokenId' => 'XXX',
    'tokenSecret' => 'XXX',
    'dev' => true,
  ],
];

Static Renditions

The plugin automatically requests static MP4 renditions at 270p, 720p, and 1080p for every uploaded video.

File Methods

All methods are available on Kirby File objects with a mux field.

$file->muxPlaybackId()

Returns the Mux playback ID.

$file->muxUrlLow()

Returns the URL to the 270p static MP4 rendition. Waits for renditions to be ready if necessary.

$file->muxUrlHigh()

Returns the URL to the 1080p static MP4 rendition (falls back to 720p if only one rendition file is available). Waits for renditions to be ready if necessary.

$file->muxUrlStream()

Returns the HLS streaming URL (.m3u8).

$file->muxThumbnail($width, $height, $time, $extension)

Returns a Mux thumbnail URL.

Parameter Type Default Description
$width int null Thumbnail width
$height int null Thumbnail height (enables smartcrop)
$time float null Time in seconds for the frame
$extension string jpg Image format (jpg, png, webp)

$file->muxThumbnailAnimated($width, $height, $start, $end, $fps, $extension)

Returns a Mux animated thumbnail URL.

Parameter Type Default Description
$width int null Thumbnail width
$height int null Thumbnail height
$start float null Start time in seconds
$end float null End time in seconds
$fps int null Frames per second
$extension string gif Format (gif or webp)

$file->muxKirbyThumbnail()

Returns a Kirby File object for the Mux thumbnail. Downloads and saves the thumbnail locally on first call.

Hooks

The plugin handles the full lifecycle of video files automatically:

  • file.create:after — Uploads the video to Mux, waits for processing, saves a thumbnail, and stores asset data.
  • file.delete:before — Deletes the Mux asset and removes the local thumbnail.
  • file.replace:before — Deletes the old Mux asset.
  • file.replace:after — Uploads the replacement video to Mux and processes it.

Blueprints

The plugin provides two blueprints:

  • files/mux-video — File blueprint for Mux video files
  • blocks/mux-video — Block blueprint for embedding Mux videos

Caveats

The plugin does not include any frontend-facing code or snippets. To stream videos from Mux, implement your own video player. HLS.js is a good option.

License

MIT

统计信息

  • 总下载量: 10
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-03-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固