GithubHelp home page GithubHelp logo

friday-night-funkin-mp4-video-support's Introduction

HaxeFlixel - MP4 support

Made by PolybiusProxy.

Original Repository - https://github.com/polybiusproxy/PolyEngine

1. Download the repository:

You can either download it as a ZIP, or git cloning it.

2. Edit Project.xml

After:

<assets path="assets/week6"    library="week6"    exclude="*.ogg" if="web"/>
<assets path="assets/week6"    library="week6"    exclude="*.mp3" unless="web"/>

Put:

<assets path="assets/videos" exclude="*.mp3" if="web"/>
<assets path="assets/videos" exclude="*.ogg" unless="web"/>

<assets path="plugins/" rename='' if="windows"/>
<assets path="dlls/" rename='' if="windows"/>

3. Setting up the paths

In Paths.hx, put this code:

After:

inline static public function soundRandom(key:String, min:Int, max:Int, ?library:String)
{
	return sound(key + FlxG.random.int(min, max), library);
}

Put:

inline static public function video(key:String, ?library:String)
{
	trace('assets/videos/$key.mp4');
	return getPath('videos/$key.mp4', BINARY, library);
}

4. Playing videos

Put your video in assets/videos. WARNING: IT MUST BE IN 1280x720px.

To play a video at the beginning of a week in Story Mode, add the following code in StoryMenuState.hx:

First, add a variable called isCutscene:

var isCutscene:Bool = false;

Then replace these lines:

new FlxTimer().start(1, function(tmr:FlxTimer)
{
	LoadingState.loadAndSwitchState(new PlayState(), true);
});

with:

var video:MP4Handler = new MP4Handler();

if (curWeek == 0 && !isCutscene) // Checks if the current week is Tutorial.
{
    video.playMP4(Paths.video('yourvideonamehere'), new PlayState()); 
    isCutscene = true;
}
else
{
    new FlxTimer().start(1, function(tmr:FlxTimer)
    {
        if (isCutscene)
            video.onVLCComplete();

        LoadingState.loadAndSwitchState(new PlayState(), true);
    });
}

To play a cutscene before another week, replace curWeek == 0 with the number of the week of your choice (-1, because arrays start from 0).

To play a cutscene after an individual song, place the following code in PlayState.hx before the line prevCamFollow = camFollow; in the endSong() function. You can wrap it in an "if" statement if you'd like to restrict it to a specific song.

var video:MP4Handler = new MP4Handler();
video.playMP4(Paths.video('yourvideonamehere'), new PlayState()); 

Then, comment out or delete the following lines immediately next to the code you just added.

FlxTransitionableState.skipNextTransIn = true;
FlxTransitionableState.skipNextTransOut = true;

Outputting to a FlxSprite

There are many reasons to do this, as with a FlxSprite you can do layering in play state. or where ever else.

To do this simply make a FlxSprite and do a playMP4 call with the argument. Then just add the sprite, and you're done!

var sprite:FlxSprite = new FlxSprite(0,0);

var video:MP4Handler = new MP4Handler();
video.playMP4(Paths.video('yourvideonamehere'), null, sprite); // make the transition null so it doesn't take you out of this state

add(sprite);

friday-night-funkin-mp4-video-support's People

Contributors

brightfyregit avatar deandimarzo avatar kade-github avatar polybiusproxy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

jaiden076

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.