Gaboose / hxCodec

Haxe library for native video support on HaxeFlixel.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hxCodec

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


Instructions

1. Install the library

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

2. Modify Project.xml

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" />

Playing videos

You can play videos in just 2 lines of code:

var video:hxcodec.flixel.VideoHandler = new hxcodec.flixel.VideoHandler();
video.playVideo('assets/video.mp4');

Building

Windows and MacOS

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.

Linux

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 

Android

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() or Context.getCacheDir()
  • From external storage: Context.getExternalFilesDir() or Context.getExternalCacheDir().

You will also have to put the location manually in the paths and to copy that video to the respective path.

Licensing

hxCodec is made available under the Mozilla Public License 2.0. Check LICENSE for more information.

libVLC is the engine of VLC released under the LGPLv2 License (or later). Check VideoLAN.org for more information.

Credits

About

Haxe library for native video support on HaxeFlixel.

License:Mozilla Public License 2.0


Languages

Language:C 74.4%Language:Haxe 21.2%Language:C++ 4.4%