I want to be able to play a video inside the JME3 environment, so that I have video texture-like sprites/object in my application. I found a example on google which demonstrates that, but it looks like one of the function calls changed in jme, and now accepts a different kind of data.
Example url: http://vlcj.googlecode.com/svn/wiki/JMonkeyEngineExample.wiki
In the example the display method looks like this:
public void display(Memory memory) {
// BEWARE!
//
// Synchronisation might be required...
// Copy the native memory to the video image
videoImage.setData(memory.getByteBuffer(0, WIDTH * HEIGHT * DEPTH));
// Set the new image on the texture
videoTexture.setImage(videoImage);
}
But when I copied it into jme, i got a warning about a missing method, and that was:
public void display(DirectMediaPlayer arg0, Memory[] arg1, BufferFormat arg2)
So clearly, it is the same method, but it is different now. I tried creating a ByteBuffer array list, and feeding in the data from arg1, but every time I get a critical error, and the entire application just crashes, but I do hear the audio until it crashes, so vlcj obviously works, but the ByteBuffer seems to be a mess.
How do I transform the data from the Memory[] type into a ByteBuffer ArrayList?
Edit: I managed to stop the crashing at exit by adding the following method:
public void destroy(){
System.exit(0);
}
It crashed because there were threads left running, and System.exit(0); terminates them all before exiting.