VLCJ - playing a rtsp stream video in eclipse, but not after make executable JAR

192 views Asked by At

I have a rtsp stream client application. It takes rtsp stream address from cam1.bin file and works fine in eclipse, but after export to executable JAR there is a problem. Probably with absolutepath, I geuss so. I've tried many ways to fix this by absolutepath, but no result.

public static void main(String [] args) {
    
JFrame f = new JFrame();
f.setLocation(100,100);
f.setSize(1200,720);    
f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);   
f.setVisible(true); 
//f.setAlwaysOnTop(true);
f.setTitle("rtsp app");

Canvas c = new Canvas();
c.setBackground(Color.black);
JPanel p = new JPanel();
p.setLayout(new BorderLayout());

p.add(c);
f.add(p);


NativeLibrary.addSearchPath(RuntimeUtil.getLibVlcLibraryName(),"lib");
Native.loadLibrary(RuntimeUtil.getLibVlcLibraryName(), LibVlc.class);

MediaPlayerFactory mpf = new MediaPlayerFactory();
EmbeddedMediaPlayer emp = mpf.newEmbeddedMediaPlayer(new Win32FullScreenStrategy(f));
emp.setVideoSurface(mpf.newVideoSurface(c));
//emp.toggleFullScreen();
emp.setEnableMouseInputHandling(false);
emp.setEnableKeyInputHandling(false);



try{
    DataInputStream strumien = new DataInputStream(new FileInputStream("cam1.bin"));
    
    String file= (strumien.readUTF()); 
            
    emp.prepareMedia(file);
    
    emp.play();
    
    strumien.close();   
} catch(FileNotFoundException e){
    System.out.println("File not found");
} catch(IOException e){
    System.out.println("OI error");
}
}

}

Any ideas, advice?

Thank you in advance.

0

There are 0 answers