|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.awt.Component java.awt.Container javax.swing.JComponent javax.swing.JPanel edu.ucsb.nmsl.tools.CaptionedMediaPlayer
public class CaptionedMediaPlayer
This class is reponsible for aggregating a Player object and an XML file containing captions and playing those captions back with synchronized with a media file. Currently the format of the XML file is that set by QAD, however, this may change to SMIL in the near future.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class javax.swing.JPanel |
---|
javax.swing.JPanel.AccessibleJPanel |
Nested classes/interfaces inherited from class javax.swing.JComponent |
---|
javax.swing.JComponent.AccessibleJComponent |
Nested classes/interfaces inherited from class java.awt.Container |
---|
java.awt.Container.AccessibleAWTContainer |
Nested classes/interfaces inherited from class java.awt.Component |
---|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy |
Field Summary | |
---|---|
(package private) javax.xml.parsers.DocumentBuilder |
builder
The DocumentBuilder object used for parsing the caption XML file. |
(package private) javax.swing.JTextPane |
caption
The JTextPane object that displays the captions. |
protected static int |
CAPTION_ELEMENT_INDEX
First element of the caption file. |
(package private) int |
captionIndex
Index of the current caption. |
(package private) java.util.Vector |
captionList
The list of captions and their times. |
(package private) org.w3c.dom.Document |
captions
The Document object that actually contains the caption XML file. |
protected static java.lang.String |
CAPTIONS_ELEMENT_NAME
Name of captions element in XML file. |
(package private) javax.swing.Timer |
captionTimer
The timer that is used to synchronize the media and the caption text. |
(package private) java.awt.Container |
container
The Container object that holds the captions and media controls. |
protected static java.lang.String |
LANGUAGE_ELEMENT_NAME
Name of the language element in XML file. |
protected static int |
MILLISECONDS_PER_SECOND
Number of milliseconds per second. |
(package private) javax.media.Player |
player
The player object from JMF to play the media file. |
protected static int |
PREFERRED_CAPTION_HEIGHT
Preferred height of the Swing widget that displays the caption. |
protected static double |
SUPPORTED_MEDIA_RATE
|
protected static java.lang.String |
TEXT_ATTRIBUTE_NAME
Name of the text attribute in XML file. |
protected static java.lang.String |
TIME_ELEMENT_NAME
Name of the time stamp element in XML file. |
protected static java.lang.String |
VALUE_ATTRIBUTE_NAME
Name of the value attribute in XML file. |
Fields inherited from class javax.swing.JComponent |
---|
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW |
Fields inherited from class java.awt.Component |
---|
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
---|
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Constructor Summary | |
---|---|
CaptionedMediaPlayer()
The default constuctor. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
ActionListener method that is called whenever a timeout occurs. |
void |
controllerUpdate(javax.media.ControllerEvent event)
Listener method that reacts to media events from the player. |
protected int |
findCaptionIndex(double now)
A helper function that finds the caption closest to the time given with in the media stream. |
static void |
main(java.lang.String[] argv)
Instantiates the CaptionedMediaPlayer and parses the command line arguments to make sure the right number of arguments are passed in. |
protected void |
parseCaptions(org.w3c.dom.Document doc)
Helper method that parses the XML file and stores each caption in a vector. |
void |
play(javax.media.Player p,
org.w3c.dom.Document c)
This method is called to play a media file along with its captions. |
void |
stop()
This method is called when the media playing is stopped. |
Methods inherited from class javax.swing.JPanel |
---|
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI |
Methods inherited from class javax.swing.JComponent |
---|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, 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, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update |
Methods inherited from class java.awt.Container |
---|
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree |
Methods inherited from class java.awt.Component |
---|
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, 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, hide, 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, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, 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, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
javax.media.Player player
javax.swing.JTextPane caption
java.awt.Container container
javax.xml.parsers.DocumentBuilder builder
org.w3c.dom.Document captions
java.util.Vector captionList
int captionIndex
javax.swing.Timer captionTimer
protected static final java.lang.String CAPTIONS_ELEMENT_NAME
protected static final java.lang.String TIME_ELEMENT_NAME
protected static final java.lang.String LANGUAGE_ELEMENT_NAME
protected static final java.lang.String TEXT_ATTRIBUTE_NAME
protected static final java.lang.String VALUE_ATTRIBUTE_NAME
protected static final int CAPTION_ELEMENT_INDEX
protected static final int PREFERRED_CAPTION_HEIGHT
protected static final int MILLISECONDS_PER_SECOND
protected static final double SUPPORTED_MEDIA_RATE
Constructor Detail |
---|
public CaptionedMediaPlayer()
Method Detail |
---|
protected void parseCaptions(org.w3c.dom.Document doc)
doc
- The XML document object (specfically DOM) that contains the
captions.public void play(javax.media.Player p, org.w3c.dom.Document c)
p
- The Player object from JMF that plays the media.c
- Document object that holds the caption information.public void stop()
protected int findCaptionIndex(double now)
now
- The current time the media player is at.
public void controllerUpdate(javax.media.ControllerEvent event)
controllerUpdate
in interface javax.media.ControllerListener
event
- The controller event that occurred.public void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
e
- The ActionEvent corresponding to a timeout (hopefully).public static void main(java.lang.String[] argv)
argv
- The command line arguments
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |