diff --git a/.vscode/settings.json b/.vscode/settings.json index a8a67245b2..d47913d489 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -171,9 +171,9 @@ "args": ["-debug", "-DANIMDEBUG", "-DFORCE_DEBUG_VERSION"] }, { - "label": "Windows / Debug (Debug hxCodec)", + "label": "Windows / Debug (Debug hxvlc)", "target": "windows", - "args": ["-debug", "-DHXC_LIBVLC_LOGGING", "-DFORCE_DEBUG_VERSION"] + "args": ["-debug", "-DHXVLC_LOGGING", "-DHXVLC_VERBOSE=2", "-DFORCE_DEBUG_VERSION"] }, { "label": "HashLink / Debug (Straight to Animation Editor)", diff --git a/Project.xml b/Project.xml index 24cdac2700..230ec73b9e 100644 --- a/Project.xml +++ b/Project.xml @@ -123,7 +123,7 @@ - + diff --git a/hmm.json b/hmm.json index 288aa80b8b..606ef2b854 100644 --- a/hmm.json +++ b/hmm.json @@ -77,11 +77,9 @@ "version": "2.5.0" }, { - "name": "hxCodec", - "type": "git", - "dir": null, - "ref": "61b98a7a353b7f529a8fec84ed9afc919a2dffdd", - "url": "https://github.com/FunkinCrew/hxCodec" + "name": "hxvlc", + "type": "haxelib", + "version": "1.8.5" }, { "name": "hxcpp", diff --git a/source/funkin/graphics/video/FlxVideo.hx b/source/funkin/graphics/video/FlxVideo.hx index a0fab9c09b..15c5daea3f 100644 --- a/source/funkin/graphics/video/FlxVideo.hx +++ b/source/funkin/graphics/video/FlxVideo.hx @@ -12,8 +12,8 @@ import openfl.net.NetStream; /** * Plays a video via a NetStream. Only works on HTML5. - * This does NOT replace hxCodec, nor does hxCodec replace this. - * hxCodec only works on desktop and does not work on HTML5! + * This does NOT replace hxvlc, nor does hxvlc replace this. + * hxvlc only works on desktop and does not work on HTML5! */ class FlxVideo extends FunkinSprite { diff --git a/source/funkin/play/cutscene/VideoCutscene.hx b/source/funkin/play/cutscene/VideoCutscene.hx index 01a492a77a..011be4b0a9 100644 --- a/source/funkin/play/cutscene/VideoCutscene.hx +++ b/source/funkin/play/cutscene/VideoCutscene.hx @@ -10,8 +10,8 @@ import flixel.util.FlxTimer; #if html5 import funkin.graphics.video.FlxVideo; #end -#if hxCodec -import hxcodec.flixel.FlxVideoSprite; +#if hxvlc +import hxvlc.flixel.FlxVideoSprite; #end /** @@ -25,7 +25,7 @@ class VideoCutscene #if html5 static var vid:FlxVideo; #end - #if hxCodec + #if hxvlc static var vid:FlxVideoSprite; #end @@ -93,8 +93,8 @@ class VideoCutscene #if html5 playVideoHTML5(rawFilePath); - #elseif hxCodec - playVideoNative(rawFilePath); + #elseif hxvlc + playVideoNative(filePath); #else throw "No video support for this platform!"; #end @@ -102,7 +102,7 @@ class VideoCutscene public static function isPlaying():Bool { - #if (html5 || hxCodec) + #if (html5 || hxvlc) return vid != null; #else return false; @@ -135,7 +135,7 @@ class VideoCutscene } #end - #if hxCodec + #if hxvlc static function playVideoNative(filePath:String):Void { // Video displays OVER the FlxState. @@ -152,10 +152,9 @@ class VideoCutscene PlayState.instance.add(vid); PlayState.instance.refresh(); - vid.play(filePath, false); // Resize videos bigger or smaller than the screen. - vid.bitmap.onTextureSetup.add(() -> { + vid.bitmap.onFormatSetup.add(() -> { vid.setGraphicSize(FlxG.width, FlxG.height); vid.updateHitbox(); vid.x = 0; @@ -163,7 +162,12 @@ class VideoCutscene // vid.scale.set(0.5, 0.5); }); - onVideoStarted.dispatch(); + if (vid.load(openfl.Assets.getBytes(filePath))) + { + vid.play(); + + onVideoStarted.dispatch(); + } } else { @@ -182,11 +186,12 @@ class VideoCutscene } #end - #if hxCodec + #if hxvlc if (vid != null) { // Seek to the start of the video. vid.bitmap.time = 0; + if (resume) { // Resume the video if it was paused. @@ -208,7 +213,7 @@ class VideoCutscene } #end - #if hxCodec + #if hxvlc if (vid != null) { vid.pause(); @@ -227,7 +232,7 @@ class VideoCutscene } #end - #if hxCodec + #if hxvlc if (vid != null) { vid.visible = false; @@ -246,7 +251,7 @@ class VideoCutscene } #end - #if hxCodec + #if hxvlc if (vid != null) { vid.visible = true; @@ -265,7 +270,7 @@ class VideoCutscene } #end - #if hxCodec + #if hxvlc if (vid != null) { vid.resume(); @@ -292,7 +297,7 @@ class VideoCutscene } #end - #if hxCodec + #if hxvlc if (vid != null) { vid.stop(); @@ -300,7 +305,7 @@ class VideoCutscene } #end - #if (html5 || hxCodec) + #if (html5 || hxvlc) vid.destroy(); vid = null; #end diff --git a/source/funkin/ui/title/AttractState.hx b/source/funkin/ui/title/AttractState.hx index c5a3d05048..81684a8611 100644 --- a/source/funkin/ui/title/AttractState.hx +++ b/source/funkin/ui/title/AttractState.hx @@ -3,8 +3,8 @@ package funkin.ui.title; #if html5 import funkin.graphics.video.FlxVideo; #end -#if hxCodec -import hxcodec.flixel.FlxVideoSprite; +#if hxvlc +import hxvlc.flixel.FlxVideoSprite; #end import funkin.ui.MusicBeatState; @@ -17,7 +17,13 @@ import funkin.ui.MusicBeatState; */ class AttractState extends MusicBeatState { + #if html5 static final ATTRACT_VIDEO_PATH:String = Paths.stripLibrary(Paths.videos('toyCommercial')); + #end + + #if hxvlc + static final ATTRACT_VIDEO_PATH:String = Paths.videos('toyCommercial'); + #end public override function create():Void { @@ -33,7 +39,7 @@ class AttractState extends MusicBeatState playVideoHTML5(ATTRACT_VIDEO_PATH); #end - #if hxCodec + #if hxvlc trace('Playing native video ${ATTRACT_VIDEO_PATH}'); playVideoNative(ATTRACT_VIDEO_PATH); #end @@ -61,7 +67,7 @@ class AttractState extends MusicBeatState } #end - #if hxCodec + #if hxvlc var vid:FlxVideoSprite; function playVideoNative(filePath:String):Void @@ -73,9 +79,10 @@ class AttractState extends MusicBeatState { vid.zIndex = 0; vid.bitmap.onEndReached.add(onAttractEnd); - add(vid); - vid.play(filePath, false); + + if (vid.load(openfl.Assets.getBytes(filePath))) + vid.play(); } else { @@ -108,7 +115,7 @@ class AttractState extends MusicBeatState } #end - #if hxCodec + #if hxvlc if (vid != null) { vid.stop(); @@ -116,7 +123,7 @@ class AttractState extends MusicBeatState } #end - #if (html5 || hxCodec) + #if (html5 || hxvlc) vid.destroy(); vid = null; #end diff --git a/tests/unit/project.xml b/tests/unit/project.xml index dfbf06502d..6f534e2296 100644 --- a/tests/unit/project.xml +++ b/tests/unit/project.xml @@ -24,7 +24,7 @@ - + diff --git a/tests/unit/test.hxml b/tests/unit/test.hxml index cece0c43ad..f6e9cd65a2 100644 --- a/tests/unit/test.hxml +++ b/tests/unit/test.hxml @@ -13,7 +13,7 @@ -lib haxeui-core -lib haxeui-flixel -lib flxanimate --lib hxCodec +-lib hxvlc -lib thx.semver -lib json2object -lib tink_json diff --git a/tests/unit/test.hxml-old b/tests/unit/test.hxml-old index e8a7d9bde1..b91276cefd 100644 --- a/tests/unit/test.hxml-old +++ b/tests/unit/test.hxml-old @@ -15,7 +15,7 @@ -lib haxeui-core -lib haxeui-flixel -lib flxanimate --lib hxCodec +-lib hxvlc -lib thx.semver -lib json2object -lib tink_json @@ -48,7 +48,7 @@ -lib haxeui-flixel -lib polymod -lib flxanimate --lib hxCodec +-lib hxvlc -lib thx.semver -lib json2object -lib tink_json