MapEngine Media Extension

适用于MapEngine的FFmpeg媒体扩展库

资源图片
# MapEngine Media Extension logo [![GitHub tag (latest by date)](https://img.shields.io/github/v/tag/TheJoCraftNET/MapEngine-MediaExtension?style=flat-square)](#) [![AGPLv3 License](https://img.shields.io/badge/License-AGPL%20v3-yellow.svg?style=flat-square)](https://opensource.org/license/agpl-v3/) [![Status Beta](https://img.shields.io/badge/Status-Beta-orange?style=flat-square)](#) ## Description MapEngine Media Extension 是为 [MapEngine](https://modrinth.com/plugin/mapengine) 设计的扩展库。 它提供了一个额外的 API,用于使用 MapEngine 播放视频和流式传输实时内容。 该扩展使用 [bytedeco/javacv](https://github.com/bytedeco/javacv) 的 FFmpeg 实现进行媒体解码。 JavaCV、JavaCPP 和 FFmpeg 将在服务器启动时下载并加载到类路径中。 该插件仅下载当前操作系统和架构所需的库。 ## Features - 运行时依赖下载器 - 基于 FFmpeg 的媒体解码
下载原生库 这是一个在服务器启动时下载原生库的示例。 ![RuntimeDependencyLoading](https://i.imgur.com/GMWH9NW.gif)
通过 RTMP 在地图上进行实时流媒体 这是一个在地图上进行实时流媒体的示例。该流在一个 7x4 的地图数组上播放。 流源是 1920x1080@20,使用 OBS 传输。  
## Usage 无论使用哪种构建系统,都必须将 `MapMediaExt` 添加到 `plugin.yml` 作为依赖项。
Maven ```xml tjcserver https://repo.thejocraft.net/releases/ ``` ```xml de.pianoman911 mapengine-mediaext 1.1.2 provided ```
Gradle (groovy) ```groovy repositories { maven { url = 'https://repo.thejocraft.net/releases/' name = 'tjcserver' } } dependencies { compileOnly 'de.pianoman911:mapengine-mediaext:1.1.2' } ```
Gradle (kotlin) ```kotlin repositories { maven("https://repo.thejocraft.net/releases/") { name = "tjcserver" } } dependencies { compileOnly("de.pianoman911:mapengine-mediaext:1.1.2") } ```
### Example ```java public class Bar { public void foo(IMapDisplay display, URI streamUri) { // create a drawing space for the display IDrawingSpace space = plugin.mapEngine().pipeline().drawingSpace(display); // add all online players as receivers space.ctx().receivers().addAll(Bukkit.getOnlinePlayers()); // create a new frame source with a 10 frame buffer and rescaling enabled FFmpegFrameSource source = new FFmpegFrameSource(streamUri, 10, space, true); // start the decoding process source.start(); } } ``` 更多详细的示例可以在 [TheJoCraftNET/MapEngineExamples](https://github.com/TheJoCraftNET/MapEngineExamples) 仓库中找到。 ## Building 1. 克隆项目 (`git clone https://github.com/TheJoCraftNET/MapEngine-MediaExtension.git`) 2. 进入克隆的目录 (`cd MapEngine-MediaExtension`) 3. 构建 Jar (`./gradlew build` on Linux/MacOS, `gradlew build` on Windows) 插件 jar 可以在 `build` → `libs` 目录中找到。