hxMP4

Native video support for HaxeFlixel & OpenFL (polybiusproxy - hxCodec, JuniorNovoa1 - Uploaded old version as a lib)
https://github.com/JuniorNovoa1/hxMP4

To install, run:

haxelib install hxMP4 2.6.0 

See using Haxelib in Haxelib documentation for more information.

README.md

hxMP4

A library which has old Friday Night Funkin' MP4 support working for macos.

Using libVLC, hxCodec allows to play hundreds of video codecs.

Original repository
Click here to check the roadmap


Instructions for Friday Night Funkin'

  1. Install the Haxelib You can install it through haxelib:
haxelib install hxMP4

You can also install it through Git for the latest updates:

haxelib git hxMP4 https://github.com/JuniorNovoa1/hxMP4
  1. Add this code in Project.xml
<haxelib name="hxMP4" if="mac" />

OPTIONAL: If you want debug traces in your console, add this code:

<!-- Show debug traces for hxCodec -->
<haxedef name="HXC_DEBUG_TRACE" if="debug" />
  1. Create a folder called videos in your assets/preload folder.

  2. Add this code in Paths.hx:

inline static public function video(key:String)
{
	return 'assets/videos/$key.mp4';
}

Playing videos

  1. Put your video in the videos folder.

Note: hxMP4 only supports MP4 videos!

  1. Add somewhere in PlayState:
function playCutscene(name:String, atEndOfSong:Bool = false)
{
	inCutscene = true;
	FlxG.sound.music.stop();

	var video:VideoHandler = new VideoHandler();
	video.finishCallback = function()
	{
		if (atEndOfSong)
		{
			if (storyPlaylist.length <= 0)
				FlxG.switchState(new StoryMenuState());
			else
			{
				SONG = Song.loadFromJson(storyPlaylist[0].toLowerCase());
				FlxG.switchState(new PlayState());
			}
		}
		else
			startCountdown();
	}
	video.playVideo(Paths.video(name));
}

Examples

At the PlayState "create()" function:

switch (curSong.toLowerCase())
{
	case 'song1':
		playCutscene('song1scene');
	case 'song2':
		playCutscene('song2scene');
	default:
		startCountdown();
}

At the PlayState "endSong()" function:

if (SONG.song.toLowerCase() == 'song1')
	playCutscene('song1scene', true);

Examples for Kade Engine 1.8

At the PlayState "create()" function:

generateSong(SONG.songId);

switch (curSong.toLowerCase())
{
	case 'song1':
		playCutscene('song1scene.mp4');
	default:
		startCountdown();
}

At the PlayState "endSong()" function:

PlayState.SONG = Song.loadFromJson(PlayState.storyPlaylist[0], diff);
FlxG.sound.music.stop();

switch (curSong.toLowerCase())
{
	case 'song1':
		playCutscene('song1scene.ogg', true);
	case 'song2':
		playCutscene('song2scene.wav', true);
}

Building

MacOS

You don't need any special instructions in order to build for Windows or MacOS. Just pull the lime build mac command and the library will be building with your game.


Credits

Contributors
polybiusproxy
JuniorNovoa1
Version
2.6.0
Published
3 years ago
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub