-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
78 additions
and
5 deletions.
There are no files selected for viewing
Binary file not shown.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
package; | ||
|
||
import flixel.FlxG; | ||
import flixel.FlxState; | ||
|
||
#if (hxCodec >= "3.0.0") import hxcodec.flixel.FlxVideo as VideoHandler; | ||
#elseif (hxCodec >= "2.6.1") import hxcodec.VideoHandler as VideoHandler; | ||
#elseif (hxCodec == "2.6.0") import VideoHandler; | ||
#else import vlc.MP4Handler as VideoHandler; #end | ||
|
||
#if desktop | ||
import sys.FileSystem; | ||
#end | ||
|
||
class VideoCutsceneState extends MusicBeatState { | ||
|
||
public static var videoFile:String; | ||
public static var targetState:flixel.FlxState; | ||
|
||
public override function create() { | ||
super.create(); | ||
|
||
FlxG.sound.music.stop(); | ||
|
||
startVideo(videoFile); | ||
} | ||
|
||
public function startVideo(name:String) | ||
{ | ||
var filepath:String = Paths.video(name); | ||
#if sys | ||
if(!FileSystem.exists(filepath)) | ||
#else | ||
if(!OpenFlAssets.exists(filepath)) | ||
#end | ||
{ | ||
FlxG.log.warn('Couldnt find video file: ' + name); | ||
return; | ||
} | ||
|
||
var video:VideoHandler = new VideoHandler(); | ||
#if (hxCodec >= "3.0.0") | ||
// Recent versions | ||
video.play(filepath); | ||
video.onEndReached.add(function() | ||
{ | ||
video.dispose(); | ||
FlxG.switchState(targetState); | ||
return; | ||
}, true); | ||
#else | ||
// Older versions | ||
video.playVideo(filepath); | ||
video.finishCallback = function() | ||
{ | ||
FlxG.switchState(targetState); | ||
return; | ||
} | ||
#end | ||
} | ||
} |