I\'m trying to play a video using vlcj inside a JPanel but it doesn\'t work for me. The message exception I am getting is \"java.lang.IllegalStateException: The video surfac
You're trying to play the media before the frame containing the canvas has been set to be visible. You'll need to put the playMedia() call in a separate method, and call it after the entire frame has been created and set as visible.
EDIT:
If you still want it to play straight off, just call the relevant method after you've created and made your frame visible:
MyJFrame frame = new MyJFrame();
frame.setVisible(true);
frame.startPlaying();
...obviously you'll need to define startPlaying() on MyJFrame, but then it should start playing straight off. you just need to set the frame visible first.