定制 tobimori/kirby-mux 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

tobimori/kirby-mux

Composer 安装命令:

composer require tobimori/kirby-mux

包简介

Use Mux to upload and manage videos in Kirby

README 文档

README

Experimental plugin for adding Mux video support to Kirby. This is used in production of multiple on my sites for years, but I don't think it's ready for a paid-for "production release". If you're interested in this plugin, please send me an email and I can provide a custom offer for implementation in your site.

Setup

1. Install the Plugin

Add the plugin to your Kirby project (installation method will be added when the plugin is published).

2. Configure API Keys

Add your Mux API credentials to your Kirby config file:

<?php
// site/config/config.php

return [
  'tobimori.mux' => [
    'tokenId' => 'XXX',        // Your Mux API Access Token ID
    'tokenSecret' => 'XXX',    // Your Mux API Secret Key  
    'signingSecret' => 'XXX'   // Your webhook signing secret
  ]
];

3. Set Up Webhooks

In your Mux dashboard, create a webhook with the following URL:

https://yourdomain.com/mux-endpoint

4. Create a Page Model

Create a page model that uses the HasMuxFiles trait:

<?php
// site/models/videos.php

use tobimori\Mux\HasMuxFiles;

class VideosPage extends \Kirby\Cms\Page
{
    use HasMuxFiles;
}

5. Create a Blueprint

Create a blueprint for managing video files:

# site/blueprints/pages/videos.yml
title: Videos
image:
  icon: file-video

sections:
  files:
    label: Videos
    type: files
    layout: cards
    template: mux-video
    uploads:
      template: mux-video
    image:
      ratio: 16/9
    search: true
    sortBy: title desc
    text: "{{ file.title.or(file.filename) }}"
    info: "{{ file.niceDuration }}"

Usage

Displaying Videos

Use the Mux video player in your templates:

<mux-video playback-id="<?= $page->video()->toFile()->playbackId()->getId() ?>"></mux-video>

Make sure to include the Mux player library in your frontend.

Limitations

  • Uploading from localhost doesn't work; please use a tunnel (e.g. ngrok/expose)
  • Works with public (unsigned) playback ids only

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: proprietary
  • 更新时间: 2025-06-24