Hi !
Featured games (84)
games approved by the League of Dukes
Games in Showcase (601)
Games in Android Showcase (171)
games submitted by our members
Games in WIP (649)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  Video Playback - Java Media Framework  (Read 2596 times)
0 Members and 1 Guest are viewing this topic.
Offline Cero
« Posted 2009-07-06 18:01:47 »

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

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

Offline Cero
« Reply #1 - Posted 2009-07-07 08:02:25 »

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

Offline Cero
« Reply #2 - Posted 2009-07-07 08:29:26 »

again: windowed works everytime perfectly.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Cero
« Reply #3 - Posted 2009-07-07 13:45:22 »

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 ?

Offline CommanderKeith
« Reply #4 - Posted 2009-07-07 14:52:53 »

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.

Offline Cero
« Reply #5 - Posted 2009-07-07 15:57:45 »

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

Offline princec

« JGO Spiffy Duke »

Medals: 555
Projects: 3
Exp: 16 years

Eh? Who? What? ... Me?

« Reply #6 - Posted 2009-07-07 16:38:36 »

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 Smiley

Offline Mr_Light

Senior Devvie

Medals: 1


« Reply #7 - Posted 2009-07-07 18:16:34 »

Yes, JMF is shit.
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.

It's harder to read code than to write it. - it's even harder to write readable code.

The gospel of brother Riven: "The guarantee that all bugs are in *your* code is worth gold." Amen brother a-m-e-n.
Offline Cero
« Reply #8 - Posted 2009-07-07 20:50:59 »

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

Offline zammbi

JGO Coder

Medals: 4

« Reply #9 - Posted 2009-07-08 13:17:49 »

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.

Current project - Rename and Sort
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Cero
« Reply #10 - Posted 2009-07-08 17:48:17 »

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

but I would really kill for Bink Video ( for Java

Pages: [1]
  ignore  |  Print  
You cannot reply to this message, because it is very, very old.

Jesse (12 views)
2015-07-29 04:35:27

Riven (35 views)
2015-07-27 16:38:00

Riven (18 views)
2015-07-27 15:35:20

Riven (20 views)
2015-07-27 12:26:13

Riven (11 views)
2015-07-27 12:23:39

BurntPizza (30 views)
2015-07-25 00:14:37

BurntPizza (41 views)
2015-07-24 22:06:39

BurntPizza (24 views)
2015-07-24 06:06:53

NoxInc (27 views)
2015-07-22 22:16:53

NoxInc (18 views)
2015-07-22 22:13:39
List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30

Intersection Methods
by Roquen
2015-05-29 08:19:33

List of Learning Resources
by SilverTiger
2015-05-05 10:20:32

How to: JGO Wiki
by Mac70
2015-02-17 20:56:16

2D Dynamic Lighting
by ThePixelPony
2015-01-01 20:25:42

How do I start Java Game Development?
by gouessej
2014-12-27 19:41:21 is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!