0

I use this code to convert a video with xuggler: http://www.jochenhebbrecht.be/site/2010-10-12/java/converting-resizing-videos-in-java-xuggler

The convertion works fine and the line:

reader.addListener(ToolFactory.makeViewer(true));

let me view two windows with video and statistics.The problem is, after converting the windows don't close automatically and I don't know how to do it.

I changed the above line into

IMediaListener imL=ToolFactory.makeViewer(IMediaViewer.Mode.FAST_VIDEO_ONLY,true);
reader.addListener(imL);

and after the while I insert

reader.removeListener(imL);
            reader.close();

But the windows don't disappear after converting/ task finished.So I want to know how I can get access to this windows to achieve a simple stage.close().

EDIT: I'm using Java 8

EDIT2: I now tried

StageHelper.getStages().size(); //-> 1

and

Iterator<Window> windows=Window.impl_getWindows();
String window_String="";
while(windows.hasNext()){
    window_String+=" |-> "+
}  
System.out.println("WINDOWS: ---->"+Window.impl_getWindows());

Both shows that there is just ONE window.It seems, that the windows from "reader.addListener(ToolFactory.makeViewer(true));" are not in the list.

user3776738
  • 214
  • 2
  • 10
  • 27
  • Unfornately I'm using still Java 8 and I can't change for this project. – user3776738 Apr 19 '18 at 12:13
  • 1
    The class `ToolFactory` is from Xuggler? But it seems like Xuggler uses Swing and not JavaFX so the correct way to get the windows is [`java.awt.Window.getWindows()`](https://docs.oracle.com/javase/8/docs/api/java/awt/Window.html#getWindows--). –  Apr 25 '18 at 13:18
  • Thanks this did the trick! – user3776738 Apr 26 '18 at 09:39

1 Answers1

1

The Problem is that Xuggler uses Swing and not JavaFX so Window.impl_getWindows() and StageHelper.getStages() wont return the windows that are create with ToolFactory.makeViewer(true).

So the correct way is java.awt.Window.getWindows().