Jump to content
  • Advertisement
Sign in to follow this  

[java] How to close Frame window after it player video?(JMF)

This topic is 4270 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Iam using Java media framework to play intro from my game. I've got one class(it extends Frame) which takes care about playing video and another class(which is in LWJGL OPenGl window)to start the game. I want to play video in and after it and I want to create class which start the game and close the Frame window. Please take a look on code. Class playing video
ublic class VideoPlayer extends Frame implements ControllerListener{
    private Player videoPlayer;
    public VideoPlayer() {
     addWindowListener(new WindowAdapter() {
      public void windowClosing(WindowEvent we) {
    public static void playVideo() {
        VideoPlayer prehravac = new VideoPlayer(); 
        prehravac.setLocation(0, 0);
    public void play()  
        URL url;
        try {
            url = new URL("file:///f:\\1.mov");
            videoPlayer = Manager.createPlayer(url);
        } catch (Exception e) {

    public synchronized void controllerUpdate(ControllerEvent event) {
    if (event instanceof RealizeCompleteEvent) {
    	Component comp;
    	if ((comp = videoPlayer.getVisualComponent()) != null)
    		add ("Center", comp);
Main method of game(in LWJGL OpenGl Window
public static void main(String[] args)
		Window window = new Window(1024,768,true);
Probably this isnt best way to play video, but if you got better I will be pleased if you share it with me. Thank to every advice.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!