Sitelet https://github.com/Slushi-Github/HxSwitchVideo
Skip to content

Latest commit

 

History

11 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

HxSwitchVideo

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.

Installation

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-lz4

Usage

Here 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();

Custom settings

  • Define SWITCHVIDEO_LOGGING on your Project.xml file to enable logging.

  • You can override the switchvideo.backend.SwitchVideoLog.logCallBack variable, by default it uses haxe.Log.trace but 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
    }

Credits

  • @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.

License

This project is released under the MIT license.

MPV is released under the GPLv2 license.

About

A HaxeFlixel library for @:native video playback using MPV for the Nintendo Switch.

Resources

Stars

5 stars

Watchers

1 watching

Forks

Contributors

Languages