• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Play JMF Video (uses JFrame) Over Graphics During Game

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am currently building a Sonic game and the main game itself is mostly done. I run it all through a Graphics2D object and it all works fine. However, I realized that I wanted to add in video capabilities for certain screens and cutscenes, because it is much easier to show one video than storing a ton of animations in memory. Anyways, I have installed and got a video player working through JMF (Java Media Framework). When I run it by itself, I simply create a new JFrame and add the video player to it, which works great. However, during my game, since it is constantly updating the Graphics2D object and repainting, it always paints over the video when I run it. I would like to know how to add the video player directly to my graphics object (similar to how I use drawImage() ) for drawing animations and things, so that the video plays in the graphics object instead of under it, and can be treated similarly to the rest of my graphics on the screen.

Here is teh VideoPlayer class that I have taken from JMF and tweaked for my needs...



Also, here is the class which creates the main loop for the game...



And finally, here is the ScreenManager class which is referenced from the Core class.



//a lot of the code in these core classes were taken from a tutorial on TheNewboston.

So anyways, my game runs fine, I have graphcis, music, the works all in it and it is playable. I just need a way to play videos during the game w/o them being painted over by the Graphics object which is drawing all the other stuff. Thanks
 
Ike Gentz
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also I just wanted to note that if it is not possible to add the video / the JFrame containing the video to the Grahics object, is there a way to simply display the JFrame OVER the graphics? I already set it to "alwaysOnTop" but I believe this only applies to other SWING components and that is why it does not work.
 
reply
    Bookmark Topic Watch Topic
  • New Topic