Class EmbeddedMediaPlayer


  • public class EmbeddedMediaPlayer
    extends MediaPlayer
    Implementation of a media player that renders video to an video surface embedded in the application user interface.

    Note that to get mouse and keyboard events delivered via listeners on some platforms (i.e. Windows) you will likely need to invoke InputApi.enableMouseInputHandling(boolean) and InputApi.enableKeyInputHandling(boolean).

    This implementation supports the use of a heavyweight 'overlay' window that will track the video surface position and size. Such an overlay could be used to paint custom graphics over the top of the video.

    The overlay window should be non-opaque - support for this depends on the JVM, desktop window manager and graphics device hardware and software.

    The overlay also has some significant limitations, it is a component that covers the video surface component and will prevent mouse and keyboard events from being processed by the video surface. Workarounds to delegate the mouse and keyboard events to the underlying component may be possible but that is a responsibility of the overlay itself.

    The overlay will also 'lag' the main application frame when the frame is dragged - the event used to track the frame position does not fire until after the window drag operation has completed (i.e. the mouse pointer is released).

    A further limitation is that the overlay will not appear when full-screen exclusive mode is used - if an overlay is required in full-screen mode then the full-screen mode must be simulated (by re-sizing the main window, removing decorations and so on).

    If an overlay is used, then because the window is required to be non-opaque then it will appear in front of all other desktop windows, including application dialog windows. For this reason, it may be necessary to disable the overlay while displaying dialog boxes, or when the window is deactivated.

    The overlay implementation in this class simply keeps a supplied window in sync with the video surface. It is the responsibility of the client application itself to supply an appropriate overlay component.

    • Constructor Detail

      • EmbeddedMediaPlayer

        public EmbeddedMediaPlayer​(uk.co.caprica.vlcj.binding.LibVlc libvlc,
                                   uk.co.caprica.vlcj.binding.internal.libvlc_instance_t instance)
        Create a new media player.

        Full-screen will not be supported.

        Parameters:
        libvlc - native interface
        instance - libvlc instance