MediaPlayer
Media Decoding Library for Minecraft
Based on the powerful ffmpeg technology, this library provides advanced capabilities for working with video and audio content directly in the game.
Key Features
- Video and audio decoding - support for playing media files of various formats
- Hardware acceleration - optimized performance through utilization of your hardware capabilities
- Wide format support - works with most popular media formats
- Cross-platform compatibility - currently only Windows x64 is supported
Usage for Players
To play video, use the commands:
/summon mediaplayer:video
/mediaplayer video
To play audio:
/mediaplayer audio
To stop all active video and audio:
/mediaplayer clear
For Developers
Creating a decoder:
var file = new File("<video file path>");
var decoder = VideoDecoder.create(file);
Decoding and rendering frames:
decoder.fetch();
bufferSource.getBuffer(VideoRenderType.create(decoder.frame));
/ Rendering code /
Playing audio from video:
Minecraft.getInstance().getSoundManager().play(new AudioInstance(decoder.audio.decode(false), null));
Playing independent audio:
Minecraft.getInstance().getSoundManager().play(new AudioInstance(new AudioDecoder.decode(false), null));