Code: Select all
mediaPlayerFactory = new MediaPlayerFactory(VLC_ARGS);
mediaPlayer = mediaPlayerFactory.newEmbeddedMediaPlayer();
mediaPlayer.addMediaPlayerEventListener(new PlayerListener());
videoCanvas = new uk.co.caprica.vlcj.runtime.windows.WindowsCanvas();
videoCanvas.setBackground(Color.black);
playerPanel.add(videoCanvas, BorderLayout.CENTER);
mediaPlayer.setVideoSurface(mediaPlayerFactory.newVideoSurface(videoCanvas));
Code: Select all
playerPanel.addComponentListener(new ComponentAdapter()
{
@Override
public void componentResized(final ComponentEvent componentEvent)
{
if (componentEvent != null)
{
Component component = componentEvent.getComponent();
if (component != null)
{
Dimension size = component.getSize();
if (size != null)
{
videoCanvas.setSize(size.width, size.height);
}
}
}
}
});
Return to “Development around libVLC”
Users browsing this forum: No registered users and 9 guests