Class VLCjDirectRenderPanel

  • All Implemented Interfaces:
    adams.core.CleanUpHandler, adams.gui.core.MenuBarProvider, ImageObserver, MenuContainer, Serializable, Accessible

    public class VLCjDirectRenderPanel
    extends adams.gui.core.BasePanel
    implements adams.gui.core.MenuBarProvider, adams.core.CleanUpHandler
    A basic video player. Allows a user to open, play, and pause video
    sjb90 (sjb90 at students dot waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail


        protected static final double DEFAULT_RATE
        the values used for playback rate
        See Also:
        Constant Field Values
      • m_Properties

        protected static adams.core.Properties m_Properties
        the properties to use.
      • m_MenuBar

        protected JMenuBar m_MenuBar
        the menu bar, if used.
      • m_MenuFileLoadRecent

        protected JMenu m_MenuFileLoadRecent
        the "load recent" submenu.
      • m_RecentFilesHandler

        protected adams.gui.core.RecentFilesHandler<JMenu> m_RecentFilesHandler
        for handling recent files.
      • m_MenuItemFileClose

        protected JMenuItem m_MenuItemFileClose
        the menu item "close".
      • m_MenuItemFileOpen

        protected JMenuItem m_MenuItemFileOpen
        the menu item "open".
      • m_FileChooser

        protected adams.gui.chooser.BaseFileChooser m_FileChooser
        the file chooser
      • m_MenuItemVideoShowHideControls

        protected JMenuItem m_MenuItemVideoShowHideControls
        the menu item "show/hide controls"
      • m_MenuItemVideoPlay

        protected JMenuItem m_MenuItemVideoPlay
        the menu item "play"
      • m_MenuItemVideoPause

        protected JMenuItem m_MenuItemVideoPause
        the menu item "pause"
      • m_MenuItemVideoStop

        protected JMenuItem m_MenuItemVideoStop
        the menu item "stop"
      • m_MenuItemSetSpeed

        protected JMenuItem m_MenuItemSetSpeed
        the menu item "Set Speed"
      • m_CurrentFile

        protected File m_CurrentFile
        The path to the file we're currently viewing
      • m_Logger

        protected adams.core.logging.Logger m_Logger
        the logger used to output information to the adams console
      • m_ControlsPanel

        protected adams.gui.core.BasePanel m_ControlsPanel
        the panel for our video controls
      • m_SliderPosition

        protected JSlider m_SliderPosition
        slider for changing video position
      • m_SpinnerRate

        protected JSpinner m_SpinnerRate
        spinner for setting the playback rate
      • m_ButtonPlay

        protected adams.gui.core.BaseButton m_ButtonPlay
        the "play" button
      • m_ButtonPause

        protected adams.gui.core.BaseButton m_ButtonPause
        the "pause" button
      • m_ButtonStop

        protected adams.gui.core.BaseButton m_ButtonStop
        the "pause" button
      • m_ButtonMute

        protected adams.gui.core.BaseButton m_ButtonMute
        Mute button
      • m_TitleGenerator

        protected adams.gui.core.TitleGenerator m_TitleGenerator
        for generating the title.
      • m_VideoPaused

        protected boolean m_VideoPaused
        flag to say if video is paused
      • m_VideoLoaded

        protected boolean m_VideoLoaded
        flag to say if video is loaded
      • m_VLCInstalled

        protected boolean m_VLCInstalled
        flag to check that VLC is installed.
      • m_VideoPlaying

        protected boolean m_VideoPlaying
        flag for player state, playing/not playing
      • m_ExecutorHandler

        protected ScheduledFuture<?> m_ExecutorHandler
        the handler for the scheduled event
      • m_LabelPlaybackTime

        protected JLabel m_LabelPlaybackTime
        label for time
      • m_LabelMediaLength

        protected JLabel m_LabelMediaLength
        label for the length of the current media file
      • m_PlaybackTime

        protected long m_PlaybackTime
        current playback time
      • m_MediaLength

        protected long m_MediaLength
        media length
      • m_dateFormatter

        protected adams.core.DateFormat m_dateFormatter
        Date formatter for outputing timestamps
      • m_PlayListeners

        protected Set<ActionListener> m_PlayListeners
        the listeners for the play event.
      • m_PauseListeners

        protected Set<ActionListener> m_PauseListeners
        the listeners for the play event.
      • m_StopListeners

        protected Set<ActionListener> m_StopListeners
        the listeners for the play event.
      • m_MuteListeners

        protected Set<ActionListener> m_MuteListeners
        the listeners for the play event.
    • Constructor Detail

      • VLCjDirectRenderPanel

        public VLCjDirectRenderPanel()
    • Method Detail

      • initialize

        protected void initialize()
        For initializing members.
        initialize in class adams.gui.core.BasePanel
      • initGUI

        public void initGUI()
        For initializing the GUI.
        initGUI in class adams.gui.core.BasePanel
      • finishInit

        protected void finishInit()
        finishes the initialization.
        finishInit in class adams.gui.core.BasePanel
      • setPlaybackRate

        public void setPlaybackRate​(String rateString)
        Sets the playback rate to the given rate
        rateString - the playback rate (1.0 is normal speed)
      • setTitle

        public void setTitle​(String value)
        Sets the base title to use for the title generator.
        value - the title to use
        See Also:
      • getTitle

        public String getTitle()
        Returns the base title in use by the title generator.
        the title in use
        See Also:
      • getTitleGenerator

        public adams.gui.core.TitleGenerator getTitleGenerator()
        Returns the title generator in use.
        the generator
      • getMenuBar

        public JMenuBar getMenuBar()
        Creates a menu bar (singleton per panel object). Can be used in frames.
        Specified by:
        getMenuBar in interface adams.gui.core.MenuBarProvider
        the menu bar
      • pause

        public void pause()
        Pauses the video assuming there is a video loaded and playing
      • play

        public void play()
        Plays or stops the video depending on what state it's in currently. If there is no video loaded then nothing happens.
      • stop

        public void stop()
        Stops the video
      • mute

        public void mute()
        Mutes the video
      • unmute

        public void unmute()
        Unmutes the video
      • toggleMute

        public void toggleMute()
        Toggles the mute state.
      • enterPlaybackSpeed

        public void enterPlaybackSpeed()
        Updates the playback speed with the user entered value.
      • getFileChooser

        protected adams.gui.chooser.BaseFileChooser getFileChooser()
        Returns the file chooser to use.
        the file chooser
      • open

        public boolean open()
        Pops up dialog to open a file.
        true if video got loaded
      • open

        public boolean open​(File file)
        Opens the specified file.
        file - the file to open
        true if video got loaded
      • close

        protected void close()
        Closes the dialog, if possible.
      • cleanUp

        public void cleanUp()
        Cleans up data structures, frees up memory.
        Specified by:
        cleanUp in interface adams.core.CleanUpHandler
      • update

        protected void update()
        Updates title and menu items.
      • updateTitle

        protected void updateTitle()
        Updates the title of the dialog.
      • updateMenu

        protected void updateMenu()
        Updates the state of the menu items.
      • updateControls

        protected void updateControls()
        Updates the state of the buttons.
      • showControls

        public void showControls​(boolean show)
        Hides or shows the control panel
      • getProperties

        protected static adams.core.Properties getProperties()
        Returns the properties to use for the video player.
        the properties
      • getTimeStamp

        public long getTimeStamp()
        Returns the current video time in milliseconds
      • addPlayListener

        public void addPlayListener​(ActionListener l)
        Adds the listener for the play events.
        l - the listener to add
      • removePlayListener

        public void removePlayListener​(ActionListener l)
        Removes the listener for the play events.
        l - the listener to remove
      • notifyPlayListeners

        protected void notifyPlayListeners()
        Notifies all play listeners.
      • addPauseListener

        public void addPauseListener​(ActionListener l)
        Adds the listener for the pause events.
        l - the listener to add
      • removePauseListener

        public void removePauseListener​(ActionListener l)
        Removes the listener for the pause events.
        l - the listener to remove
      • notifyPauseListeners

        protected void notifyPauseListeners()
        Notifies all pause listeners.
      • addStopListener

        public void addStopListener​(ActionListener l)
        Adds the listener for the stop events.
        l - the listener to add
      • removeStopListener

        public void removeStopListener​(ActionListener l)
        Removes the listener for the stop events.
        l - the listener to remove
      • notifyStopListeners

        protected void notifyStopListeners()
        Notifies all stop listeners.
      • addMuteListener

        public void addMuteListener​(ActionListener l)
        Adds the listener for the mute events.
        l - the listener to add
      • removeMuteListener

        public void removeMuteListener​(ActionListener l)
        Removes the listener for the mute events.
        l - the listener to remove
      • notifyMuteListeners

        protected void notifyMuteListeners()
        Notifies all mute listeners.
      • getCurrentFile

        public File getCurrentFile()
      • isVideoPaused

        public boolean isVideoPaused()
        Gets the paused status of the video
        true if video is paused
      • isVideoLoaded

        public boolean isVideoLoaded()
        Gets the loaded status of the video
        true if a media file is loaded
      • isVideoPlaying

        public boolean isVideoPlaying()
        Gets the playing status of the video
        returns true if the video is currently playing
      • isVLCInstalled

        public boolean isVLCInstalled()
        Gets the VLC install status
        true if VLC is installed.
      • isSoundMuted

        public boolean isSoundMuted()
        Gets the muted state of the sound
        true if the sound is muted