Reinier Zwitserloot gmail.com> writes: Hello All. In Linux dont works fine! I tried to use its code in linux and the screen of the video is for backwards of window SWT. The code modified for linux is: //Source starts here. import java.io.*; import org.eclipse.swt.*; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.RGB; import org.eclipse.swt.layout.FillLayout; import org.eclipse.swt.widgets.*; public class Player { //You'll have to edit these paths to something useful. private static final String MPLAYER = "/usr/bin/mplayer"; private static final String VIDEO_FILE = "/var/preserve/videos/video.mp4"; public static Process setFile(final File pFile, final int hWnd) throws IOException { System.out.println("------------------------"); System.out.println(hWnd); System.out.println("------------------------"); final String[] lCmds = new String[] { MPLAYER, "-wid", String.valueOf(hWnd), "-nokeepaspect", "-geometry", "0:0", "-colorkey", "0x101010", "-vo", "x11", pFile.getAbsolutePath() }; final Process lProcess = Runtime.getRuntime().exec(lCmds); final InputStream lOut1 = lProcess.getErrorStream(); final InputStream lOut2 = lProcess.getInputStream(); final Runnable lPrinter1 = new Runnable() { public void run() { try { final BufferedReader lReader = new BufferedReader(new InputStreamReader(lOut1, "UTF-8")); for ( String l = lReader.readLine() ;l != null ; l = lReader.readLine() ) { System.out.println(l); } } catch ( Throwable t ) { t.printStackTrace(); } } }; final Runnable lPrinter2 = new Runnable() { public void run() { try { run2(); } catch ( Throwable t ) { t.printStackTrace(); } } public void run2() throws Throwable { final BufferedReader lReader = new BufferedReader( new InputStreamReader(lOut2, "UTF-8")); for ( String l = lReader.readLine() ; l != null ; l = lReader.readLine() ) { System.out.println(l); } } }; new Thread(lPrinter1).start(); new Thread(lPrinter2).start(); return lProcess; } public static void main(String[] pArgs) throws Exception { final Display wDisplay = new Display(); final Shell wShell = new Shell(wDisplay, SWT.SHELL_TRIM); final FillLayout wLayout = new FillLayout(); wShell.setLayout(wLayout); final Canvas wVideo = new Canvas(wShell, SWT.EMBEDDED); final Color wColor = new Color(wDisplay, new RGB(0x10, 0x10, 0x10)); wVideo.setBackground(wColor); wShell.setSize(800, 600); wShell.layout(); wShell.setVisible(true); final Process lProcess = setFile(new File(VIDEO_FILE), wVideo.handle); while ( !wShell.isDisposed() ) { if ( !wDisplay.readAndDispatch() ) { wDisplay.sleep(); } } lProcess.destroy(); } } I tried get the Window ID (wmctrl -l) and put with mplayer -wid , but dont works too! The: "-vo", "x11" was changed... Any sugestion? thanks, Rehem > > DUUUUUUUH, of course. Now it works! All you have to add to make it work: > > final Color wColor = new Color(wDisplay, new RGB(0x10, 0x10, 0x10)); > wVideo.setBackground(wColor); > > (right after creating the Canvas; the final Canvas wVideo = new > Canvas(wShell, SWT.EMBEDDED) line). > > Thanks a lot! > > -- Reinier Zwitserloot > > On 9/11/05, Sascha Sommer freenet.de> wrote: > > > > The colorkey is the background color (as RGB value) of the video window. > > > > Sascha > > >