JME-JFX Problem

Hello everyone,
I just downloaded and installed JME-JFX, because I’d like to prerender my intro in Blender and then show it in JME.
The example class from github works fine with the movie from oracle, but if I have the exact same code in an AppState, I only get flashy blue/black change that hurts my eyes.:chimpanzee_sad:
Here is my class:

package Main.GameStates;

import Gui.Cinematics.SubtitleEvent;
import com.jme3.animation.LoopMode;
import com.jme3.cinematic.Cinematic;
import com.jme3.cinematic.MotionPath;
import com.jme3.cinematic.events.CinematicEvent;
import com.jme3.cinematic.events.CinematicEventListener;
import com.jme3.cinematic.events.MotionEvent;
import com.jme3.input.KeyInput;
import com.jme3.input.controls.ActionListener;
import com.jme3.input.controls.KeyTrigger;
import com.jme3.material.Material;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.CameraNode;
import com.jme3.scene.Geometry;
import com.jme3.scene.Node;
import com.jme3.scene.shape.Quad;
import com.jme3x.jfx.media.TextureMovie;
import com.jme3x.jfx.media.TextureMovie.LetterboxMode;
import com.sun.javafx.application.PlatformImpl;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.embed.swing.JFXPanel;
import javafx.scene.media.Media;
import javafx.scene.media.MediaException;
import javafx.scene.media.MediaPlayer;
import static javax.management.Query.gt;

/**
 *
 * @author Robbi Blechdose
 * 
 */
public class IntroState extends GenericState implements ActionListener, CinematicEventListener
{
    private Cinematic introCinematic;
    private Node introScene;
    
    private CameraNode camNode;
    
    //Motion events
    private MotionEvent camMovement;
    private MotionPath camPath;
    
    private SubtitleEvent subtitle_1;
    private SubtitleEvent subtitle_2;
    private SubtitleEvent subtitle_3;
    private SubtitleEvent subtitle_4;
    private SubtitleEvent subtitle_5;
    private SubtitleEvent subtitle_6;
    private SubtitleEvent subtitle_7;
    private SubtitleEvent subtitle_8;
    
    private Geometry screenPlane;
    
    private Media media;
    private MediaPlayer mp;
    private TextureMovie tex;
    
    public IntroState()
    {
    super();
        JFXPanel p = new JFXPanel();
    }
    
    @Override
    public void init()
    {
        introScene = (Node) assetManager.loadModel("Scenes/Intro.j3o");
        rootNode.attachChild(introScene);
        
        //Init movie
        this.screenPlane = (Geometry) ((Node)((Node)introScene.getChild("TV")).getChild("Cube")).getChild("Screen");
        
        media = new Media("http://download.oracle.com/otndocs/products/javafx/oow2010-2.flv"); //"file:///link/to/movie.mp4");
        mp = new MediaPlayer(media);
        mp.setVolume(0.5 * setVars.SOUND_VOLUME);
        mp.play();
        
        tex = new TextureMovie(this.program, mp, LetterboxMode.VALID_LETTERBOX);
//        this.tex.setLetterboxColor(ColorRGBA.Black);
        Material mat = new Material(this.assetManager, "com/jme3x/jfx/media/MovieShader.j3md");
    mat.setTexture("ColorMap", tex.getTexture());
        screenPlane.setMaterial(mat);
        
        introCinematic = new Cinematic(introScene, 35); //Adjust length as needed
        introCinematic.addListener(this);
        
        initCinematicEvents();
        
        stateManager.attach(introCinematic);
        
    inputManager.addMapping("Skip", new KeyTrigger(KeyInput.KEY_SPACE), new KeyTrigger(KeyInput.KEY_RETURN));
    inputManager.addListener(this, "Skip");
        
        guis.setIntroState(this);
        guis.createIntroScreen();
        guis.gotoIntroScreen();
        
        introCinematic.play();
    }
    
    private void initCinematicEvents()
    {
        camNode = introCinematic.bindCamera("cam", camera);
        camNode.setLocalTranslation(new Vector3f(0, 0, 10));
        camNode.lookAt(Vector3f.ZERO, new Vector3f(0, 0, 0));
        introCinematic.activateCamera(0, "cam");
        
        camPath = new MotionPath();
        camPath.addWayPoint(new Vector3f(0, 0, 10));
        camPath.addWayPoint(new Vector3f(0, 0, 3));
        camMovement = new MotionEvent(camNode, camPath);
        camMovement.setLoopMode(LoopMode.DontLoop);
        camMovement.setSpeed(1f);
        camMovement.setInitialDuration(2);
        introCinematic.addCinematicEvent(0, camMovement);
        
        initSubtitles();
    }
    
    private void initSubtitles()
    {
        subtitle_1 = new SubtitleEvent(guis.getNifty(), 3, "This is the planet Dasi. It is inhabited by robots.");
        introCinematic.addCinematicEvent(0, subtitle_1);
        
        subtitle_2 = new SubtitleEvent(guis.getNifty(), 3, "Once, they built spaceships and travelled to earth. They saw the steaming machines and locomotives.");
        introCinematic.addCinematicEvent(3, subtitle_2);
        
        subtitle_3 = new SubtitleEvent(guis.getNifty(), 3, "They liked it very much, and from then on, built everything in a style they called 'Steampunk'.");
        introCinematic.addCinematicEvent(6, subtitle_3);
        
        subtitle_4 = new SubtitleEvent(guis.getNifty(), 3, "To control everything important, they also built the CCM (Central Controlling Mechanism).");
        introCinematic.addCinematicEvent(9, subtitle_4);
        
        subtitle_5 = new SubtitleEvent(guis.getNifty(), 3, "");
        introCinematic.addCinematicEvent(12, subtitle_5);
        
        subtitle_6 = new SubtitleEvent(guis.getNifty(), 3, "But the machine is far too old now. It has started breaking apart.");
        introCinematic.addCinematicEvent(21, subtitle_6);
        
        subtitle_7 = new SubtitleEvent(guis.getNifty(), 3, "Its logic circuits failed, and the machine created a dictature.");
        introCinematic.addCinematicEvent(24, subtitle_7);
        
        subtitle_8 = new SubtitleEvent(guis.getNifty(), 3, "");
        introCinematic.addCinematicEvent(27, subtitle_8);
    }
    
    @Override
    public void onAction(String key, boolean isPressed, float tpf)
    {
    if(key.equals("Skip") && !isPressed)
    {
            introCinematic.stop();
    }
    }

    @Override
    public void onPlay(CinematicEvent cinematic)
    {
        
    }

    @Override
    public void onPause(CinematicEvent cinematic)
    {
        
    }

    @Override
    public void onStop(CinematicEvent cinematic)
    {
        if(stateManager.getState(GameState.class) == null)
    {
            stateManager.attach(new GameState(false));
    }
        mp.stop();
        rootNode.detachChild(introScene);
    }
}

Some help would be very nice. Also, the audio is playing and the screen stays black if I uncomment the letterbox color line.

try different codecs formats, javafx is unfortunatly extremly picky about what it supports.

handbrake,avidemux or ffmpeg might be helpfull tools

Thanks,
but I’m using the exact same file from the oracle URL. And in the demo file, it works, while it doesn’t in mine.

Ah ok, are you using the same version of jme?

Yes, I am.
I copied the file over into my project, so the lib configurations are 100% correct.

Hm ok :slight_smile:

My only guess then is some difference in live-cycle between your application and the test application, I fear that this will be kinda hard to debug.

So there isn’t any obvious cause?
Hm… I guess I’ll have to switch back to the cinematics then, altough they don’t look half as good for me.
Or I’ll experiment a while before that…

I don’t understand, you copied which file ?
Copying .java doesn’t garanty your lib configurations to be 100% correct.

How do the app behave if you create a Main with only this AppState ?
Can you share a project that reproduce the issue

Well, I copied the .java test class from JME-JFX into my game project, and used as a main class, it worked out of the box.
My class where it’s supposed to be used is an AppState that is created by a SimpleApplication.