A HaxeFlixel library for @:native video playback using MPV for the Nintendo Switch.
Important
This library only works with Nintendo Switch target. It is not compatible with other targets.
Install through the haxelib (Not available yet):
haxelib install hxswitchvideo
or with git for the latest updates.
haxelib git hxswitchvideo https://github.com/Slushi-Github/HxSwitchVideo.git
Then add it to your Project.xml file:
<haxelib name="hxswitchvideo" if="switch" />You will need the following libraries from DevKitPro:
(If you are on Linux/macOS, you will most likely need to use sudo dkp-pacman instead of pacman)
pacman -S switch-dav1d switch-ffmpeg switch-libarchive switch-libass switch-libexpat switch-libfribidi switch-libmpv switch-libplacebo switch-libzstd switch-lz4Here is a simple example:
// Import the library
import switchvideo.SwitchVideo;
// Create a SwitchVideo object
var switchVideo = new SwitchVideo();
// Set the video to loop (Before loading the video)
switchvideo.setLooping(true);
// Load a video
switchVideo.load("path/to/video.mp4");
switchVideo.onEndReached = function() {
// Do something when the video ends
}
// And just play the video
switchVideo.play();-
Define
SWITCHVIDEO_LOGGINGon yourProject.xmlfile to enable logging. -
You can override the
switchvideo.backend.SwitchVideoLog.logCallBackvariable, by default it useshaxe.Log.tracebut you can change the logging behavior, for example:switchvideo.backend.SwitchVideoLog.logCallBack = function(msg:String, ?pos:haxe.PosInfos) { yourLogger(msg, pos); // Add pos if your logger supports it }
-
@doggywatty: For initially creating the entire integration between MPV and HaxeFlixel to enable video playback on Switch Funkin', literally did everything I didn't dare to do, heh.
-
hxvlc: This library takes inspiration from hxvlc for mantaining a similar API.
This project is released under the MIT license.
MPV is released under the GPLv2 license.