The first video to play using the entire area of the container, then play all videos with black bars top and bottom of the container.
If I take a stop in the player before playing the next video, the video container occupies the entire space.
Code: Select all
private EmbeddedMediaPlayer player;
private MediaPlayerFactory factory;
private Frame videoFrame;
private Canvas videoSurfaceCanvas;
private CanvasVideoSurface videoSurface;
public VLC(Composite parent){
super(parent, SWT.EMBEDDED | SWT.NO_BACKGROUND);
setBackground(getDisplay().getSystemColor(SWT.COLOR_BLACK));
setBounds(getParent().getBounds());
}
@Override
public void init() {
// argumentos padr�es do vlc
String[] args = new String[] { "--no-video-title-show", "--no-xlib" };
// se existem argumentos passados para o java recupera
// os mesmos e usa ao invez do valor padr�o
if (((String[]) Session.get("args")).length > 0)
args = (String[]) Session.get("args");
// cria um AWT Frame necess�rio para conter
// o canvas usado como video surface
videoFrame = SWT_AWT.new_Frame(this);
videoFrame.setBackground(java.awt.Color.BLACK);
// canvas usado como video surface
videoSurfaceCanvas = new Canvas();
videoSurfaceCanvas.setSize(newSize().width, newSize().height);
videoSurfaceCanvas.setBackground(java.awt.Color.BLACK);
videoFrame.add(videoSurfaceCanvas);
// instancia libvlc
libvlc = LibVlcFactory.factory().create();
factory = new MediaPlayerFactory(libvlc, args);
videoSurface = factory.newVideoSurface(videoSurfaceCanvas);
// cria uma instancia unica do VLC player usando MediaPlayerFactory
player = factory.newEmbeddedMediaPlayer(new DefaultFullScreenStrategy(videoFrame));
player.setVideoSurface(videoSurface);
player.setPlaySubItems(true);
player.setFullScreen(true);
}
@Override
public void play(final MediaElement elem) {
/** @TODO
* Propriedade que armazena o caminho do vídeo.
* Pode ser utilizada para gravar log de exibição
* A hora da exibição pode ser capturada com G.timestamp()
*/
caminhoVideo = elem.path();
if(forceVideoAdjust)
player.stop();
player.playMedia(caminhoVideo);
}
Sorry, my bad.