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'
- 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- 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" />-
Create a folder called
videosin yourassets/preloadfolder. -
Add this code in
Paths.hx:
inline static public function video(key:String)
{
return 'assets/videos/$key.mp4';
}
Playing videos
- Put your video in the videos folder.
Note: hxMP4 only supports MP4 videos!
- 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
- PolybiusProxy - Creator of hxCodec.
- Jigsaw - Programmer and Android support.
- datee - Creator of HaxeVLC.
- Erizur - Linux support.
- BushTrain460615 - macOS Support.
- The contributors.