com.trolltech.qt.phonon
Class VideoPlayer

java.lang.Object
  extended by com.trolltech.qt.internal.QSignalEmitterInternal
      extended by com.trolltech.qt.QSignalEmitter
          extended by com.trolltech.qt.QtJambiObject
              extended by com.trolltech.qt.core.QObject
                  extended by com.trolltech.qt.gui.QWidget
                      extended by com.trolltech.qt.phonon.VideoPlayer
All Implemented Interfaces:
QPaintDeviceInterface, QtJambiInterface

public class VideoPlayer
extends QWidget

The VideoPlayer widget is used to perform playback of video. With VideoPlayer you can get results quickly and easily. You can do the standard playback tasks like play(), pause(), and stop(), but also set a playback volume and seek - if the media and backend supports seeking.

VideoPlayer is provided for convenience and removes the need to create a media graph with a MediaObject, AudioOutput, and VideoWidget. If you need functionality not supported by the player, you can build this graph yourself.

Keep in mind that when the VideoPlayer instance is deleted the playback will stop.

A play and forget code example:

VideoPlayer *player = new VideoPlayer(Phonon::VideoCategory, parentWidget);
connect(player, SIGNAL(finished()), player, SLOT(deleteLater()));
player->play(url);

See also:
Phonon Module.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget
QWidget.RenderFlag, QWidget.RenderFlags
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9
 
Nested classes/interfaces inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
com.trolltech.qt.internal.QSignalEmitterInternal.AbstractSignalInternal
 
Field Summary
 QSignalEmitter.Signal0 finished
          This signal is emitted when the playback finished.
 
Fields inherited from class com.trolltech.qt.gui.QWidget
customContextMenuRequested
 
Fields inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
currentSender
 
Constructor Summary
VideoPlayer(Phonon.Category category)
          Constructs a new VideoPlayer instance with the specified parent.
VideoPlayer(Phonon.Category category, QWidget parent)
          Constructs a new VideoPlayer instance with the specified parent.
 
Method Summary
 AudioOutput audioOutput()
          Returns the audio output object being used by the player.
 long currentTime()
          Get the current time (in milliseconds) of the file currently being played.
 boolean isPaused()
          Returns true if it is currently paused; otherwise returns false if it is currently playing or stopped
 boolean isPlaying()
          Returns true if it is currently playing; otherwise returns false if it is currently stopped or paused
 void load(MediaSource source)
          Starts pre-loading the media data from the specified source and filling audio buffers in the backend.
 MediaObject mediaObject()
          Returns the media object being used by the player.
 void pause()
          Pauses the playback.
 void play()
          Continues playback of paused media.
 void play(MediaSource source)
          Plays the media from the given source.
 void seek(long ms)
          Seeks to the requested time.
 void setVolume(float volume)
          Sets the volume of the output as voltage factor.
 void stop()
          Stops the playback.
 long totalTime()
          Get the total time (in milliseconds) of the file currently being played.
 VideoWidget videoWidget()
          Returns the video widget being used by the player.
 float volume()
          This is the current volume of the output as voltage factor.
 
Methods inherited from class com.trolltech.qt.gui.QWidget
acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, changeEvent, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuEvent, contextMenuPolicy, cursor, depth, destroy, destroy, destroy, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, effectiveWinId, ensurePolished, enterEvent, focusInEvent, focusNextChild, focusNextPrevChild, focusOutEvent, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, inputMethodEvent, inputMethodQuery, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isMaximized, isMinimized, isModal, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyPressEvent, keyReleaseEvent, languageChange, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumSizeHint, minimumWidth, mouseDoubleClickEvent, mouseGrabber, mouseMoveEvent, mousePressEvent, mouseReleaseEvent, move, move, moveEvent, nativeParentWidget, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, paintEngine, paintEvent, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, resizeEvent, restoreGeometry, saveGeometry, scroll, scroll, setAcceptDrops, setAccessibleDescription, setAccessibleName, setAttribute, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setBaseSize, setContentsMargins, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedSize, setFixedWidth, setFocus, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setLocale, setMask, setMask, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setParent, setParent, setShortcutAutoRepeat, setShortcutAutoRepeat, setShortcutEnabled, setShortcutEnabled, setSizeIncrement, setSizeIncrement, setSizePolicy, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFilePath, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeHint, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, wheelEvent, width, widthMM, window, windowFilePath, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y
 
Methods inherited from class com.trolltech.qt.core.QObject
childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, event, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, indexOfProperty, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, properties, property, removeEventFilter, setObjectName, setParent, setProperty, startTimer, timerEvent, toString, userProperty
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, equals, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
blockSignals, disconnect, disconnect, signalsBlocked, signalSender, thread
 
Methods inherited from class com.trolltech.qt.internal.QSignalEmitterInternal
__qt_signalInitialization
 
Methods inherited from class java.lang.Object
clone, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Field Detail

finished

public final QSignalEmitter.Signal0 finished
This signal is emitted when the playback finished.

Constructor Detail

VideoPlayer

public VideoPlayer(Phonon.Category category)
Constructs a new VideoPlayer instance with the specified parent.

category is the category used for the audio output device.


VideoPlayer

public VideoPlayer(Phonon.Category category,
                   QWidget parent)
Constructs a new VideoPlayer instance with the specified parent.

category is the category used for the audio output device.

Method Detail

audioOutput

public final AudioOutput audioOutput()
Returns the audio output object being used by the player.


currentTime

public final long currentTime()
Get the current time (in milliseconds) of the file currently being played.


isPaused

public final boolean isPaused()
Returns true if it is currently paused; otherwise returns false if it is currently playing or stopped


isPlaying

public final boolean isPlaying()
Returns true if it is currently playing; otherwise returns false if it is currently stopped or paused


load

public final void load(MediaSource source)
Starts pre-loading the media data from the specified source and filling audio buffers in the backend.

When there's already a media playing (or paused) it will be stopped (the finished signal will not be emitted).


mediaObject

public final MediaObject mediaObject()
Returns the media object being used by the player.

You can manipulate the object, for instance, use it for a SeekSlider.

See also:
Phonon::SeekSlider, and Phonon::MediaObject.


pause

public final void pause()
Pauses the playback.


play

public final void play()
Continues playback of paused media. Restarts playback of a stopped media.


play

public final void play(MediaSource source)
Plays the media from the given source. Starts playback as fast as possible. This can take a considerable time depending on the URL and the backend.

If you need low latency between calling play() and the sound actually starting to play on your output device you need to use MediaObject and be able to set the URL before calling play(). Note that

audioPlayer->load(url);
audioPlayer->play();
doesn't make a difference: the application should be idle between the load and play calls so that the backend can start preloading the media and fill audio buffers.


seek

public final void seek(long ms)
Seeks to the requested time. Note that the backend is free to ignore the seek request if the media source isn't seekable.

The ms parameter is the time in milliseconds from the start of the media.


setVolume

public final void setVolume(float volume)
Sets the volume of the output as voltage factor.

1.0 means 100%, 0.5 means 50% voltage/25% power, 0.0 means 0%

See also:
volume().


stop

public final void stop()
Stops the playback.


totalTime

public final long totalTime()
Get the total time (in milliseconds) of the file currently being played.


videoWidget

public final VideoWidget videoWidget()
Returns the video widget being used by the player.


volume

public final float volume()
This is the current volume of the output as voltage factor.

1.0 means 100%, 0.5 means 50% voltage/25% power, 0.0 means 0%

See also:
setVolume().