Playing mp4/flv videos in a FlxState



  • Hi,

    I'm trying to create an opening cutscene for a game I'm making, and have been having trouble finding the best way to do it. I could make it a sprite sheet with an animation but that seems annoying and sloppy. So I wanted to try and import a video but there doesn't seem to be clear documentation on how to do it. Heres what I have so far:

    import flixel.FlxG;
    import flixel.FlxSprite;
    import flixel.FlxState;
    import flixel.text.FlxText;
    import flixel.ui.FlxButton;
    import flixel.math.FlxMath;
    import flash.net.NetConnection;
    import flash.net.NetStream;
    import flash.media.Video;
    
    function playMovie():Void{
    	var screen = new Video();
    	var connection = new NetConnection();
    	connection.connect(null);
    	var stream = new NetStream(connection);
    	screen = new Video(160,120);
    	flash.Lib.current.addChild(screen);
    	screen.attachNetStream(stream);
    	trace(" Now playing movie1.flv ");
    	stream.play("/assets/videos/movie.flv");
    }
    

    And It compiles but when i run it I get this:

    transit-185:FinalAlchemist dan$ lime test neko
    export/mac64/neko/haxe/ApplicationMain.hx:205: characters 57-75 : Warning : Use programPath instead
    2016-09-14 19:55:24.403 FinalAlchemist[3704:129105] 19:55:24.402 WARNING:  140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h.
    Invalid call
    Called from Level0.hx line 39
    Called from Level0.hx line 27
    Called from flixel/FlxState.hx line 168
    Called from flixel/FlxGame.hx line 750
    Called from flixel/FlxGame.hx line 674
    Called from flixel/FlxGame.hx line 541
    Called from openfl/_legacy/events/EventDispatcher.hx line 98
    Called from a C function
    Called from openfl/_legacy/display/DisplayObject.hx line 161
    Called from a C function
    Called from openfl/_legacy/display/DisplayObjectContainer.hx line 286
    Called from openfl/_legacy/display/Stage.hx line 1103
    Called from openfl/_legacy/display/Stage.hx line 351
    Called from openfl/_legacy/display/Stage.hx line 1084
    Called from openfl/_legacy/display/Stage.hx line 430
    AL lib: (EE) alc_cleanup: 1 device not closed 
    

    While looking for answers in the API, I tried finding documentation for flash.media.Video but I couldn't find anything. I did come across flash.media.StageVideo but for some reason when I try to import it I get this error:

    transit-185:FinalAlchemist dan$ lime test neko
    source/Level0.hx:11: characters 7-29 : Type not found : flash.media.StageVideo
    source/MenuState.hx:10: lines 10-22 : Defined in this class
    

    What am I doing wrong? Is there a better way to do this or a way to do it with a .mp4 file?

    Im using:
    actuate: [1.8.7]
    box2d: [1.2.3]
    flixel-addons: [2.1.0]
    flixel-demos: [2.2.0]
    flixel-templates: [2.0.2]
    flixel-tools: [1.1.3]
    flixel-ui: [2.1.0]
    flixel: [4.1.1]
    hxcpp: [3.3.49]
    layout: [1.2.1]
    lime-samples: [2.6.0]
    lime: [2.9.1] 3.1.0
    openfl-samples: [4.0.0]
    openfl: [3.6.1] 4.1.0
    polygonal-core: [1.0.4]
    polygonal-ds: [2.0.0-beta]
    polygonal-gl: [1.0.4]
    polygonal-motor: [0.2.0]
    polygonal-printf: [1.0.2-beta]
    polygonal-ui: [1.0.2]
    swf: [2.2.4]
    tmx: [0.2.0]

    Thank You!



  • I guess it's only available on Flash target since it's in the flash package


Log in to reply
 

Looks like your connection to HaxeFlixel was lost, please wait while we try to reconnect.