Skip to content

Commit

Permalink
youve got a pregnant bee
Browse files Browse the repository at this point in the history
  • Loading branch information
MaybeMaru committed Jun 28, 2024
1 parent f9c4eab commit d4ec68b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions source/funkin/objects/FunkVideo.hx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ class FunkVideo extends Sprite implements IFlxDestroyable
video = new Video(FlxSprite.defaultAntialiasing);
video.onEndReached.add(endVideo);
addChild(video);

video.onOpening.add(() -> {
if (!FlxG.signals.postUpdate.has(postUpdate))
FlxG.signals.postUpdate.add(postUpdate);
});

#elseif web
video = new Video();
addChild(video);
Expand Down Expand Up @@ -87,6 +93,9 @@ class FunkVideo extends Sprite implements IFlxDestroyable
FlxG.state.visible = true;
if (video != null)
video.dispose();

if (FlxG.signals.postUpdate.has(postUpdate))
FlxG.signals.postUpdate.remove(postUpdate);
#elseif web
FlxG.state.visible = true;
if (netStream != null) {
Expand All @@ -101,4 +110,19 @@ class FunkVideo extends Sprite implements IFlxDestroyable
if (FlxG.game.contains(this))
FlxG.game.removeChild(this);
}

// Stole this from hxvlc to be safe when FlxVideo becomes deprecated lmao
function postUpdate() {
video.width = FlxG.scaleMode.gameSize.x;
video.height = FlxG.scaleMode.gameSize.y;

var volume:Float = FlxG.sound.muted ? 0 : FlxG.sound.volume;

#if hxvlc
video.volume = Std.int(volume * 100);
#elseif web
@:privateAccess
netStream.__video.volume = volume;
#end
}
}

0 comments on commit d4ec68b

Please sign in to comment.