Video Playback - Java Media Framework

Im trying to develop a versatile video playback class for my game

I have a windowed version which works every time. but this fullscreen which is the same, works only sometimes.

just try multiple times and you will see, like in 50% of your tries you wont see anything but hear

http://www.artificialzeromedia.com/publishvideoproblem.rar

now if alt+tab out and in again it works again

so this is some kind of video memory allocation problem of some sort. if aynone has an idea…

also note that for fullscreens I usually use BufferStrategy but since I just want to show video and nothing else, I deleted that because… well double buffering and stuff would cause the video to flicker, and I ultimately couldn’t stop it

EDIT: you need the classpath which is used in the batch, although your javac path may differ
the app shuts itself down after 10 secs, after the video finished
you may use ESC to stop the app
also: might only work for windows, because if the JMF version

I mapped repaint() to a keyboard key

if the frame starts and you do not see the video, and press the key doing repaint(), you will see the video
but if you do it again the video is invisible again and so on

i cant check per code if the user sees the video

whats going on ? its like its double buffered and when I use repaint() he just shows me the other screen, but its not

again: windowed works everytime perfectly.

aside from all that another problem

I have a seperate folder with the video problem and my main game I am developing

I COPY class and java files, the jmf and of course the MPEG file to my game project, and include all shit
if I run the class solo it works, if I run the class using netBeans it says “Unable to handle format:…”
when I run the same exact class using a batch file / pure cmd line, it works, but if I use netBeans he says that he cannot handle the FORMAT

thats a lie.

code not working the same everytime you start it up, code that lies to you

this JMF is a bunch of shit, but I see no other means of playing videos in java ?

It’s probably random due to threading trouble, probably related to Swing’s event dispatch thread.

Try pausing for a few seconds between the iportant calls in your code to see if that makes a difference.

I assume your talking about the video not showing up problem, not the netbeans format problem.

ya I did that of course. like trying to sleep between stuff, but it doesnt work because the video is either visible at start or not, and calling repaint will reverse its visibility

now I mapped the whole video to a button, like when you press A the video will be shown
so you could freely wait a couple of seconds. but again sometimes it doesnt work

but its only like 25% now, but still =P

Yes, JMF is shit. Your best bet is probably to write your own native interfaces using JNI if it’s really serious. I ended up doing that, to use NCTVideo.

Cas :slight_smile:

Oh Yes please let someone implement a pure java video playback solution.

Failing that, I believe javafx also has a video playback capabilities and the linux version was finally finished afaik.

my current class works
but in like 15% of all tries, it will not display the video
calling repaint() once, if it isnt displayed, fixes it

problem is: how can I find out in code if the user can actually see the vid this time or not =/
I dont think its possible…

again for the ones who haven’t downloaded the source: a awt.Frame and the video is a awt.Component

I believe Java 7 is getting media stuff correct?
Otherwise JavaFx seems fine in terms of media. From what I’ve tested in demos it has worked fine.

well I will leave the class as it is, should be ok

but I would really kill for Bink Video (http://www.radgametools.com/) for Java