extension-videoview
Basic native video support for Android in HaxeFlixel using Java VideoView.
Installation
To install extension-videoview, follow these steps:
-
Install the latest stable version with this command:
haxelib install extension-videoviewYou can also install through Git for the latest updates.
haxelib git extension-videoview https://github.com/Joalor64/extension-videoview -
Add this code to your
Project.xml:<haxelib name="extension-videoview" if="android" />
Usage Example
#if android
import extension.videoview.VideoView;
#end
import flixel.FlxBasic;
class VideoPlayer extends FlxBasic
{
public var finishCallback:Void->Void = null;
public function new(name:String)
{
super();
#if android
VideoView.playVideo('assets/videos/$name.mp4'); // the video can be in any format (e.g., .webm, .mkv, .etc)
VideoView.onCompletion = function()
{
if (finishCallback != null)
{
finishCallback();
}
}
#end
}
}
By the way, this extension can also run videos from the web browser.
Licensing
extension-videoview is made available under the MIT License. Check LICENSE for more information.
Credits
- Mihai Alexandru (M.A. Jigsaw) - Creator of extension-videoview
- Joalor64 - Fixes and Adjustments