A library which adds native video support on HaxeFlixel.
Using libVLC, hxCodec allows to play hundreds of video codecs.
Click here to check the roadmap
Install the latest stable version of hxCodec by running the following Haxelib command:
haxelib install hxCodec
You can also install it through Git to get the latest changes:
haxelib git hxCodec https://github.com/polybiusproxy/hxCodec
Add this code in the Project.xml file:
<haxelib name="hxCodec" if="desktop || android" />
OPTIONAL: If you want debug traces in your console when compiling in debug mode, add this:
<!-- Show debug traces for hxCodec -->
<haxedef name="HXC_DEBUG_TRACE" if="debug" />
You can play videos in just 2 lines of code:
var video:hxcodec.flixel.VideoHandler = new hxcodec.flixel.VideoHandler();
video.playVideo('assets/video.mp4');
You don't need any special instructions in order to build for Windows or MacOS.
Just run the lime build windows
/ lime build mac
command and the library will be building with your game.
In order to build a application with the library, you have to install libvlc-dev
and libvlccore-dev
from your distro's package manager.
Example with APT:
sudo apt-get install libvlc-dev libvlccore-dev
Currently, hxCodec can load videos only from internal / external storage (not from the application storage). In order for hxCodec to work on Android, you will need a library called extension-androidtools.
To install it, enter the following in a terminal:
haxelib git extension-androidtools https://github.com/MAJigsaw77/extension-androidtools.git
Next, add this into Project.xml
<haxelib name="extension-androidtools" if="android" />
You can choose whether you want to use after you import this in your code.
import android.content.Context;
- From internal storage:
Context.getFilesDir()
orContext.getCacheDir()
- From external storage:
Context.getExternalFilesDir()
orContext.getExternalCacheDir()
.
You will also have to put the location manually in the paths and to copy that video to the respective path.
hxCodec is made available under the MIT License. Check LICENSE for more information.
libVLC is the engine of VLC released under the LGPLv2 License (or later). Check VideoLAN.org for more information.
- PolybiusProxy - Creator of hxCodec.
- datee - Creator of HaxeVLC.
- Jigsaw - Programmer, Android & Linux support.
- BushTrain - macOS support.
- The contributors.