Skip to content

Commit

Permalink
fixed videos crashing (finally)
Browse files Browse the repository at this point in the history
it was a missing library, the whole time
  • Loading branch information
moxie-coder committed Jan 2, 2025
1 parent a8ab974 commit 990bbc5
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 12 deletions.
2 changes: 1 addition & 1 deletion hmm.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
{
"name": "hxCodec",
"type": "haxelib",
"version": "2.6.1"
"version": "2.5.1"
},
{
"name": "hscript",
Expand Down
5 changes: 0 additions & 5 deletions source/Conductor.hx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,6 @@ package;

import Song.SwagSong;

/**
* ...
* @author
*/

typedef BPMChangeEvent =
{
var stepTime:Int;
Expand Down
4 changes: 3 additions & 1 deletion source/Paths.hx
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,9 @@ class Paths
return file;
}
#end
return 'assets/${(library != null) ? '$library/' : ''}videos/$key.$VIDEO_EXT';
final path:String = ('assets/${(library != null) ? '$library/' : ''}videos/$key.$VIDEO_EXT');
trace('Video Path before being passed to hxCodec: $path');
return path;
}
//Sound loading.
static public function sound(key:String, ?library:String):Sound
Expand Down
29 changes: 24 additions & 5 deletions source/StartupState.hx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,25 @@ class StartupState extends MusicBeatState
}

function doIntro() {
var theIntro:Int = FlxG.random.int(0, maxIntros);
#if debug // for testing purposes
final vidSprite = new MP4Handler(); // it plays but it doesn't show???
#if (hxCodec < "3.0.0")
vidSprite.playVideo(Paths.video('broCopiedDenpa', 'splash'), false, false);
vidSprite.finishCallback = function()
{
try { vidSprite.dispose(); }
catch (e) {}
FlxG.switchState(TitleState.new);
};
#else
vidSprite.play(Paths.video('broCopiedDenpa', 'splash'));
vidSprite.onEndReached.add(function(){
vidSprite.dispose();
FlxG.switchState(TitleState.new);
});
#end
#else
final theIntro:Int = FlxG.random.int(0, maxIntros);
switch (theIntro) {
case 0:
FlxG.sound.play(Paths.sound('startup', 'splash'));
Expand Down Expand Up @@ -106,15 +124,15 @@ class StartupState extends MusicBeatState
#if VIDEOS_ALLOWED
var vidSprite = new MP4Handler(); // it plays but it doesn't show???
#if (hxCodec < "3.0.0")
vidSprite.playVideo(Paths.video('bambiStartup'), false, false);
vidSprite.playVideo(Paths.video('bambiStartup', 'splash'), false, false);
vidSprite.finishCallback = function()
{
try { vidSprite.dispose(); }
catch (e) {}
FlxG.switchState(TitleState.new);
};
#else
vidSprite.play(Paths.video('bambiStartup'));
vidSprite.play(Paths.video('bambiStartup', 'splash'));
vidSprite.onEndReached.add(function(){
vidSprite.dispose();
FlxG.switchState(TitleState.new);
Expand All @@ -125,15 +143,15 @@ class StartupState extends MusicBeatState
#if VIDEOS_ALLOWED
var vidSprite = new MP4Handler(); // it plays but it doesn't show???
#if (hxCodec < "3.0.0")
vidSprite.playVideo(Paths.video('broCopiedDenpa'), false, false);
vidSprite.playVideo(Paths.video('broCopiedDenpa', 'splash'), false, false);
vidSprite.finishCallback = function()
{
try { vidSprite.dispose(); }
catch (e) {}
FlxG.switchState(TitleState.new);
};
#else
vidSprite.play(Paths.video('broCopiedDenpa'));
vidSprite.play(Paths.video('broCopiedDenpa', 'splash'));
vidSprite.onEndReached.add(function(){
vidSprite.dispose();
FlxG.switchState(TitleState.new);
Expand All @@ -151,6 +169,7 @@ class StartupState extends MusicBeatState
FlxTween.tween(logo, {alpha: 1, "scale.x": 1, "scale.y": 1}, 2, {ease: FlxEase.expoOut, onComplete: _ -> onIntroDone(1.5)});
} else doIntro();
}
#end
}

override function update(elapsed:Float)
Expand Down

0 comments on commit 990bbc5

Please sign in to comment.