Class NMediaPlayer

  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JInternalFrame
                  extended by net.sourceforge.nite.gui.mediaviewer.NITEMediaPlayer
                      extended by net.sourceforge.nite.gui.mediaviewer.NITEVideoPlayer
                          extended by net.sourceforge.nite.gui.mediaviewer.NMediaPlayer
All Implemented Interfaces:
java.awt.image.ImageObserver, java.awt.MenuContainer,, javax.accessibility.Accessible, javax.swing.RootPaneContainer, javax.swing.WindowConstants, PlayingTimeHandler, TimeHandler

public class NMediaPlayer
extends NITEVideoPlayer

This media player is an extension of the video player from the NITE XML Toolkit. It can automatically load the interaction signals (both audio and video) for a certain observation. The media player adds a combo box at the top of the window listing all available signals. The names of the available signals are taken from the metadata.

When the user selects another signal from the combo box, the new signal is loaded and the player is paused and reset to the start of the signal.

This media player also adds a rate slider at the bottom of the window. It ranges from -4x (meaning that the media is played 4 times slower than normal) to +4x (the media is played 4 times faster). The default value is 0 (normal play rate). The play rate is computed with an exponential function on the distance of the slider value from 0. This means that the rate grows faster as the distance of the slider value from 0 increases. The play rate is not changed while the player is playing. A slider change will have its effect when the player is paused and playback is restarted.

If a video does not fit in the window, it is automatically scaled so that it fits.

THIS CLASS WILL BE MADE OBSOLETE THIS CLASS WILL BE MADE OBSOLETE THIS CLASS WILL BE MADE OBSOLETE THIS CLASS WILL BE MADE OBSOLETE DR: clockFace will more or less contain all functionality for which this class was made in the first place

See Also:
Serialized Form

Nested Class Summary
Nested classes/interfaces inherited from class javax.swing.JInternalFrame
Nested classes/interfaces inherited from class javax.swing.JComponent
Field Summary
Fields inherited from class javax.swing.JInternalFrame
Fields inherited from class javax.swing.JComponent
Fields inherited from class java.awt.Component
Fields inherited from interface javax.swing.WindowConstants
Fields inherited from interface java.awt.image.ImageObserver
Constructor Summary
NMediaPlayer(NMetaData newmetaData, java.lang.String newobsName, DefaultClock c)
          Constructs a new media player.
Method Summary
 void addSignalListener(SignalListener l)
          Adds a signal listener that will be notified when another signal is loaded into the media player.
 void controllerUpdate(ControllerEvent event)
          Called whenever there is a media event.
 java.lang.String getCurrentSignal()
          Returns the name of the signal that is currently loaded.
 boolean loadSignal(java.lang.String name)
          Loads the signal with the specified name.
 void removeSignalListener(SignalListener l)
          Removes a signal listener from this media player.
Methods inherited from class net.sourceforge.nite.gui.mediaviewer.NITEVideoPlayer
Methods inherited from class net.sourceforge.nite.gui.mediaviewer.NITEMediaPlayer
acceptTimeChange, acceptTimeChangeWhenPrefetched, acceptTimeSpanChange, close, Exit, fastForward, fastForward, getClock, getFileName, getID, getMaxTime, getTime, getWindSkip, isMaster, isPlaying, pastEndTime, pause, play, playWhenPrefetched, rewind, rewind, setClock, setID, setMaster, setMute, setPlayRate, setSendSynchronization, setTime, setTimeHighlightColor, setTimeSpan, setWindSkip
Methods inherited from class javax.swing.JInternalFrame
addInternalFrameListener, dispose, doDefaultCloseAction, getAccessibleContext, getContentPane, getDefaultCloseOperation, getDesktopIcon, getDesktopPane, getFocusCycleRootAncestor, getFocusOwner, getFrameIcon, getGlassPane, getInternalFrameListeners, getJMenuBar, getLayer, getLayeredPane, getMenuBar, getMostRecentFocusOwner, getNormalBounds, getRootPane, getTitle, getUI, getUIClassID, getWarningString, hide, isClosable, isClosed, isFocusCycleRoot, isIcon, isIconifiable, isMaximizable, isMaximum, isResizable, isSelected, moveToBack, moveToFront, pack, remove, removeInternalFrameListener, reshape, restoreSubcomponentFocus, setClosable, setClosed, setContentPane, setDefaultCloseOperation, setDesktopIcon, setFocusCycleRoot, setFrameIcon, setGlassPane, setIcon, setIconifiable, setJMenuBar, setLayer, setLayer, setLayeredPane, setLayout, setMaximizable, setMaximum, setMenuBar, setNormalBounds, setResizable, setSelected, setTitle, setUI, show, toBack, toFront, updateUI
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintImmediately, paintImmediately, print, printAll, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, resetKeyboardActions, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusBackward, transferFocusDownCycle, validate
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, createImage, createImage, createVolatileImage, createVolatileImage, dispatchEvent, enable, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, size, toString, transferFocus, transferFocusUpCycle
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail


public NMediaPlayer(NMetaData newmetaData,
                    java.lang.String newobsName,
                    DefaultClock c)

Constructs a new media player. The combo box at the top of the media player is filled with the names of the interaction signals that are specified in the metadata file. When a signal name is selected in the combo box, the signal for the specified observation is loaded into the player.

metaData - the metadata specifying interaction signals
obsName - the name of an observation
c - the NITE clock
Method Detail


public java.lang.String getCurrentSignal()

Returns the name of the signal that is currently loaded. If no signal is currently loaded, this method returns null

the name of the current signal or null


public boolean loadSignal(java.lang.String name)

Loads the signal with the specified name. The signal name should exist in the metadata.

name - the signal name
true if the signal exists, false otherwise


public void addSignalListener(SignalListener l)

Adds a signal listener that will be notified when another signal is loaded into the media player.

l - a signal listener


public void removeSignalListener(SignalListener l)

Removes a signal listener from this media player.

l - the signal listener that should be removed


public void controllerUpdate(ControllerEvent event)

Called whenever there is a media event. When a media file has been prefetched, this method resets the position of the media player to the saved last position. Before loading new media, the current position is saved, so it can be reset in this method. This means that the position is not reset to 0 every time another signal is selected.

controllerUpdate in class NITEMediaPlayer