|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.gui.QWidget
com.trolltech.qt.phonon.VideoPlayer
public class VideoPlayer
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);Author: Matthias Kretz <kretz@kde.org>
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.Signal0, QSignalEmitter.Signal1, QSignalEmitter.Signal2, QSignalEmitter.Signal3, QSignalEmitter.Signal4, QSignalEmitter.Signal5, QSignalEmitter.Signal6, QSignalEmitter.Signal7, QSignalEmitter.Signal8, QSignalEmitter.Signal9 |
Field Summary | |
---|---|
QSignalEmitter.Signal0 |
finished
This signal is emitted when the playback finished. |
Fields inherited from class com.trolltech.qt.gui.QWidget |
---|
customContextMenuRequested |
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. |
static VideoPlayer |
fromNativePointer(QNativePointer nativePointer)
|
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.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 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 |
---|
public final QSignalEmitter.Signal0 finished
Constructor Detail |
---|
public VideoPlayer(Phonon.Category category)
VideoPlayer
instance with the specified parent. category is the category used for the audio output device.
public VideoPlayer(Phonon.Category category, QWidget parent)
VideoPlayer
instance with the specified parent. category is the category used for the audio output device.
Method Detail |
---|
public final AudioOutput audioOutput()
public final long currentTime()
public final boolean isPaused()
public final boolean isPlaying()
public final void load(MediaSource source)
When there's already a media playing (or paused) it will be stopped (the finished signal will not be emitted).
public final MediaObject mediaObject()
You can manipulate the object, for instance, use it for a SeekSlider
.
Phonon::SeekSlider
, and Phonon::MediaObject
.
public final void pause()
public final void play()
public final void play(MediaSource source)
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.
public final void seek(long ms)
The ms parameter is the time in milliseconds from the start of the media.
public final void setVolume(float volume)
1.0 means 100%, 0.5 means 50% voltage/25% power, 0.0 means 0%
volume()
.
public final void stop()
public final long totalTime()
public final VideoWidget videoWidget()
public final float volume()
1.0 means 100%, 0.5 means 50% voltage/25% power, 0.0 means 0%
setVolume()
.
public static VideoPlayer fromNativePointer(QNativePointer nativePointer)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |