Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
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 2214 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

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

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 ?

Online 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: 434
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


shiny.


« 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 (http://www.radgametools.com/) for Java

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

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (33 views)
2014-12-15 09:26:44

Mr.CodeIt (23 views)
2014-12-14 19:50:38

BurntPizza (51 views)
2014-12-09 22:41:13

BurntPizza (84 views)
2014-12-08 04:46:31

JscottyBieshaar (45 views)
2014-12-05 12:39:02

SHC (59 views)
2014-12-03 16:27:13

CopyableCougar4 (59 views)
2014-11-29 21:32:03

toopeicgaming1999 (123 views)
2014-11-26 15:22:04

toopeicgaming1999 (114 views)
2014-11-26 15:20:36

toopeicgaming1999 (32 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org 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‑gaming.org
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!