/** * If there is an associated media player then make sure the video surface is attached. */ void attachVideoSurface() { if (mediaPlayer instanceof EmbeddedMediaPlayer) { ((EmbeddedMediaPlayer) mediaPlayer).videoSurface().attachVideoSurface(); } }
/** * Make the overlay visible. */ private void showOverlay() { if (restoreOverlay) { enable(true); } }
@Override public void actionPerformed(ActionEvent e) { mediaPlayer.videoSurface().set(previewVideoSurface); mediaPlayer.videoSurface().attachVideoSurface(); } });
public void play(String media) { player.prepareMedia(media); player.parseMedia(); player.play(); } }
/** * Get the video surface component. * <p> * This method will only be used if the video surface is a {@link ComponentVideoSurface} so we can forgo some * checks. * * @return */ private Component getComponent() { return ((ComponentVideoSurface) mediaPlayer.videoSurface().getVideoSurface()).component(); }
/** * 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 public void actionPerformed(ActionEvent e) { mediaPlayer.fullScreen().toggle(); } });
@Override public void actionPerformed(ActionEvent e) { mediaPlayer.controls().pause(); } });
protected BaseApi(EmbeddedMediaPlayer mediaPlayer) { this.mediaPlayer = mediaPlayer; this.libvlc = mediaPlayer.libvlc; this.libvlcInstance = mediaPlayer.libvlcInstance; this.mediaPlayerInstance = mediaPlayer.mediaPlayerInstance(); }
/** * Create a new embedded media player. * * @return media player instance */ public EmbeddedMediaPlayer newEmbeddedMediaPlayer() { return new EmbeddedMediaPlayer(libvlc, libvlcInstance); }
@Override public void actionPerformed(ActionEvent e) { mediaPlayer.media().play(mrl); } });
@Override public void actionPerformed(ActionEvent e) { mediaPlayer.audio().mute(); } });
@Override public void actionPerformed(ActionEvent e) { mediaPlayer.snapshots().save(); } });
@Override public void actionPerformed(ActionEvent e) { mediaPlayer.videoSurface().set(mainVideoSurface); mediaPlayer.videoSurface().attachVideoSurface(); } });
protected final void onBeforePlay() { videoSurface().attachVideoSurface(); }
/** * Hide the overlay. */ private void hideOverlay() { if (requestedOverlay) { restoreOverlay = true; enable(false); } else { restoreOverlay = false; } }
@Override public void actionPerformed(ActionEvent actionEvent) { mediaPlayer.controls().pause(); } });
@Override public void actionPerformed(ActionEvent e) { mediaPlayer.controls().pause(); } });