caprica / vlcj

Java framework for the vlc media player
http://www.capricasoftware.co.uk/projects/vlcj
1.13k stars 259 forks source link

vlcj 4.x Tutorial States ' specifically you can not use a JPanel' -- but it works when added to a JPanel... #1219

Closed FolsomMike closed 6 months ago

FolsomMike commented 6 months ago

Several tutorials on the web suggest adding the media player to a JPanel...and it does seem to work...at least on Windows.

Has the behavior changed or is the behaviour unstable?

class BasicVideoPanel extends JPanel

...
...

setLayout(new BorderLayout()); //required to display VCL object properly

mediaPlayerComponent = new EmbeddedMediaPlayerComponent();
add(mediaPlayerComponent, BorderLayout.CENTER);
caprica commented 6 months ago

You can not have video rendering in a JPanel. Video renders in Canvas only (well, unless you use software rendering).

What this refers to I think is that people want to play the video in a JPanel so they can use Graphics 2D to draw overlays on it, and that's what doesn't work.

But that does not preclude you from adding the Canvas to a JPanel parent container.