/** * Toggle whether the video display is in full-screen or not. * <p> * Setting the display into or out of full-screen mode is delegated to the currently set {@link FullScreenStrategy}, * which may be <code>null</code> (in which case full-screen mode is not supported). */ public void toggle() { if (fullScreenStrategy != null) { set(!fullScreenStrategy.isFullScreenMode()); } }
/** * Create a new media player. * <p> * Full-screen will not be supported. * * @param libvlc native interface * @param instance libvlc instance */ public EmbeddedMediaPlayer(LibVlc libvlc, libvlc_instance_t instance) { super(libvlc, instance); this.libvlc = libvlc; this.libvlcInstance = instance; this.fullScreenApi = new FullScreenApi (this); this.inputApi = new InputApi (this); this.overlayApi = new OverlayApi (this); this.videoSurfaceApi = new VideoSurfaceApi(this); }
@Override protected void onBeforeRelease() { fullScreenApi .release(); inputApi .release(); overlayApi .release(); videoSurfaceApi.release(); }
player.fullScreen().strategy(fullScreenStrategy); PlayerInstance playerInstance = new PlayerInstance(player); players.add(playerInstance);
@Override public void actionPerformed(ActionEvent e) { mediaPlayer.fullScreen().toggle(); } });
/** * Construct an embedded media player component. * <p> * Any constructor parameter may be <code>null</code>, in which case a reasonable default will be used. * * @param mediaPlayerFactory media player factory * @param videoSurfaceComponent heavyweight video surface component, will become part of this components UI layout * @param fullScreenStrategy full screen strategy * @param inputEvents keyboard/mouse input event configuration * @param overlay heavyweight overlay */ public EmbeddedMediaPlayerComponent(MediaPlayerFactory mediaPlayerFactory, Component videoSurfaceComponent, FullScreenStrategy fullScreenStrategy, InputEvents inputEvents, Window overlay) { this.ownFactory = mediaPlayerFactory == null; this.mediaPlayerFactory = initMediaPlayerFactory(mediaPlayerFactory); this.videoSurfaceComponent = initVideoSurfaceComponent(videoSurfaceComponent); this.mediaPlayer = this.mediaPlayerFactory.mediaPlayers().newEmbeddedMediaPlayer(); this.mediaPlayer.videoSurface().set(this.mediaPlayerFactory.videoSurfaces().newVideoSurface(this.videoSurfaceComponent)); this.mediaPlayer.fullScreen().strategy(fullScreenStrategy); this.mediaPlayer.overlay().set(overlay); this.mediaPlayer.events().addMediaPlayerEventListener(this); this.mediaPlayer.events().addMediaEventListener(this); setBackground(Color.black); setLayout(new BorderLayout()); add(this.videoSurfaceComponent, BorderLayout.CENTER); initInputEvents(inputEvents); onAfterConstruct(); }
mediaPlayer.fullScreen().strategy(fullScreenStrategy); mediaPlayer.videoSurface().set(mediaPlayerFactory.videoSurfaces().newVideoSurface(videoSurface));
public XFullScreenPlayerTest(String mrl) { frame = new JFrame("LibX11 Full Screen Strategy"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocation(100, 100); frame.setSize(1200, 800); frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { mediaPlayerComponent.mediaPlayer().controls().stop(); mediaPlayerComponent.release(); } }); mediaPlayerComponent = embeddedMediaPlayerSpec() .withFullScreenStrategy(new XFullScreenStrategy(frame)) .embeddedMediaPlayer(); frame.setContentPane(mediaPlayerComponent); frame.setVisible(true); mediaPlayerComponent.mediaPlayer().media().play(mrl); mediaPlayerComponent.mediaPlayer().fullScreen().set(true); }
this.mediaPlayer.fullScreen().strategy(fullScreenStrategy); this.mediaPlayer.events().addMediaPlayerEventListener(this); this.mediaPlayer.events().addMediaEventListener(this);
public Win32FullScreenPlayerTest(String mrl) { frame = new JFrame("Win32 Full Screen Strategy"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setLocation(100, 100); frame.setSize(1200, 800); frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); frame.addWindowListener(new WindowAdapter() { @Override public void windowClosing(WindowEvent e) { mediaPlayerComponent.mediaPlayer().controls().stop(); mediaPlayerComponent.release(); } }); mediaPlayerComponent = embeddedMediaPlayerSpec() .withFullScreenStrategy(new Win32FullScreenStrategy(frame)) .embeddedMediaPlayer(); frame.setContentPane(mediaPlayerComponent); frame.setVisible(true); mediaPlayerComponent.mediaPlayer().media().play(mrl); mediaPlayerComponent.mediaPlayer().fullScreen().set(true); }