![]() |
Qt 6.x
The Qt SDK
|
The QMediaPlayer class allows the playing of a media files. More...
#include <qmediaplayer.h>
Public Types | |
enum | PlaybackState { StoppedState , PlayingState , PausedState } |
Defines the current state of a media player. More... | |
enum | MediaStatus { NoMedia , LoadingMedia , LoadedMedia , StalledMedia , BufferingMedia , BufferedMedia , EndOfMedia , InvalidMedia } |
\qmlproperty enumeration QtMultimedia::MediaPlayer::playbackState More... | |
enum | Error { NoError , ResourceError , FormatError , NetworkError , AccessDeniedError } |
\qmlproperty enumeration QtMultimedia::MediaPlayer::mediaStatus More... | |
enum | Loops { Infinite = -1 , Once = 1 } |
Some predefined constants for the \l loops property. More... | |
Public Slots | |
void | play () |
\qmlmethod QtMultimedia::MediaPlayer::play() | |
void | pause () |
\qmlmethod QtMultimedia::MediaPlayer::pause() | |
void | stop () |
\qmlmethod QtMultimedia::MediaPlayer::stop() | |
void | setPosition (qint64 position) |
void | setPlaybackRate (qreal rate) |
void | setSource (const QUrl &source) |
\qmlproperty url QtMultimedia::MediaPlayer::source | |
void | setSourceDevice (QIODevice *device, const QUrl &sourceUrl=QUrl()) |
Sets the current source device. | |
![]() | |
void | deleteLater () |
\threadsafe | |
Signals | |
void | sourceChanged (const QUrl &media) |
Signals that the media source has been changed to media. | |
void | playbackStateChanged (QMediaPlayer::PlaybackState newState) |
void | mediaStatusChanged (QMediaPlayer::MediaStatus status) |
Signals that the status of the current media has changed. | |
void | durationChanged (qint64 duration) |
Signals the duration of the content has changed to duration, expressed in milliseconds. | |
void | positionChanged (qint64 position) |
Signals the position of the content has changed to position, expressed in milliseconds. | |
void | hasAudioChanged (bool available) |
Signals the availability of audio content has changed to available. | |
void | hasVideoChanged (bool videoAvailable) |
Signals the availability of visual content has changed to videoAvailable. | |
void | bufferProgressChanged (float progress) |
Signals the amount of the local buffer filled as a number between 0 and 1. | |
void | seekableChanged (bool seekable) |
Signals the seekable status of the player object has changed. | |
void | playingChanged (bool playing) |
void | playbackRateChanged (qreal rate) |
Signals the playbackRate has changed to rate. | |
void | loopsChanged () |
void | metaDataChanged () |
void | videoOutputChanged () |
void | audioOutputChanged () |
void | tracksChanged () |
void | activeTracksChanged () |
void | errorChanged () |
void | errorOccurred (QMediaPlayer::Error error, const QString &errorString) |
\qmlsignal QtMultimedia::MediaPlayer::errorOccurred(error, errorString) | |
![]() | |
void | destroyed (QObject *=nullptr) |
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked. | |
void | objectNameChanged (const QString &objectName, QPrivateSignal) |
This signal is emitted after the object's name has been changed. | |
Public Member Functions | |
QMediaPlayer (QObject *parent=nullptr) | |
Constructs a QMediaPlayer instance as a child of {parent}. | |
~QMediaPlayer () | |
Destroys the player object. | |
QList< QMediaMetaData > | audioTracks () const |
QList< QMediaMetaData > | videoTracks () const |
QList< QMediaMetaData > | subtitleTracks () const |
int | activeAudioTrack () const |
int | activeVideoTrack () const |
int | activeSubtitleTrack () const |
void | setActiveAudioTrack (int index) |
void | setActiveVideoTrack (int index) |
void | setActiveSubtitleTrack (int index) |
void | setAudioOutput (QAudioOutput *output) |
QAudioOutput * | audioOutput () const |
void | setVideoOutput (QObject *) |
QObject * | videoOutput () const |
void | setVideoSink (QVideoSink *sink) |
Sets sink to be the QVideoSink instance to retrieve video data. | |
QVideoSink * | videoSink () const |
Returns the QVideoSink instance. | |
QUrl | source () const |
const QIODevice * | sourceDevice () const |
Returns the stream source of media data. | |
PlaybackState | playbackState () const |
MediaStatus | mediaStatus () const |
qint64 | duration () const |
Returns the duration of the current media in ms. | |
qint64 | position () const |
Returns the current position inside the media being played back in ms. | |
bool | hasAudio () const |
bool | hasVideo () const |
float | bufferProgress () const |
Returns a number between 0 and 1 when buffering data. | |
QMediaTimeRange | bufferedTimeRange () const |
Returns a QMediaTimeRange describing the currently buffered data. | |
bool | isSeekable () const |
Returns true if the media is seekable. | |
qreal | playbackRate () const |
Returns the current playback rate. | |
bool | isPlaying () const |
int | loops () const |
\qmlproperty int QtMultimedia::MediaPlayer::loops | |
void | setLoops (int loops) |
Error | error () const |
Returns the current error state. | |
QString | errorString () const |
bool | isAvailable () const |
Returns true if the media player is supported on this platform. | |
QMediaMetaData | metaData () const |
![]() | |
Q_INVOKABLE | QObject (QObject *parent=nullptr) |
Constructs an object with parent object parent. | |
virtual | ~QObject () |
Destroys the object, deleting all its child objects. | |
virtual bool | event (QEvent *event) |
This virtual function receives events to an object and should return true if the event e was recognized and processed. | |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
Filters events if this object has been installed as an event filter for the watched object. | |
QString | objectName () const |
Q_WEAK_OVERLOAD void | setObjectName (const QString &name) |
Sets the object's name to name. | |
void | setObjectName (QAnyStringView name) |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
QBindable< QString > | bindableObjectName () |
bool | isWidgetType () const |
Returns true if the object is a widget; otherwise returns false . | |
bool | isWindowType () const |
Returns true if the object is a window; otherwise returns false . | |
bool | isQuickItemType () const |
Returns true if the object is a QQuickItem; otherwise returns false . | |
bool | signalsBlocked () const noexcept |
Returns true if signals are blocked; otherwise returns false . | |
bool | blockSignals (bool b) noexcept |
If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it). | |
QThread * | thread () const |
Returns the thread in which the object lives. | |
void | moveToThread (QThread *thread) |
Changes the thread affinity for this object and its children. | |
int | startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer) |
This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds. | |
int | startTimer (std::chrono::milliseconds time, Qt::TimerType timerType=Qt::CoarseTimer) |
void | killTimer (int id) |
Kills the timer with timer identifier, id. | |
template<typename T > | |
T | findChild (const QString &aName=QString(), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object. | |
template<typename T > | |
QList< T > | findChildren (const QString &aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects. | |
template<typename T > | |
QList< T > | findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const |
This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts. | |
const QObjectList & | children () const |
Returns a list of child objects. | |
void | setParent (QObject *parent) |
Makes the object a child of parent. | |
void | installEventFilter (QObject *filterObj) |
Installs an event filter filterObj on this object. | |
void | removeEventFilter (QObject *obj) |
Removes an event filter object obj from this object. | |
QMetaObject::Connection | connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const |
bool | disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const |
bool | disconnect (const QObject *receiver, const char *member=nullptr) const |
void | dumpObjectTree () const |
Dumps a tree of children to the debug output. | |
void | dumpObjectInfo () const |
Dumps information about signal connections, etc. | |
bool | setProperty (const char *name, const QVariant &value) |
Sets the value of the object's name property to value. | |
bool | setProperty (const char *name, QVariant &&value) |
QVariant | property (const char *name) const |
Returns the value of the object's name property. | |
QList< QByteArray > | dynamicPropertyNames () const |
QBindingStorage * | bindingStorage () |
const QBindingStorage * | bindingStorage () const |
QObject * | parent () const |
Returns a pointer to the parent object. | |
bool | inherits (const char *classname) const |
Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false . | |
Properties | |
QUrl | source |
the active media source being used by the player object. | |
qint64 | duration |
\qmlproperty int QtMultimedia::MediaPlayer::duration | |
qint64 | position |
\qmlproperty int QtMultimedia::MediaPlayer::position | |
float | bufferProgress |
\qmlproperty real QtMultimedia::MediaPlayer::bufferProgress | |
bool | hasAudio |
\qmlproperty bool QtMultimedia::MediaPlayer::hasAudio | |
bool | hasVideo |
\qmlproperty bool QtMultimedia::MediaPlayer::hasVideo | |
bool | seekable |
\qmlproperty bool QtMultimedia::MediaPlayer::seekable | |
bool | playing |
\qmlproperty bool QtMultimedia::MediaPlayer::playing | |
qreal | playbackRate |
\qmlproperty real QtMultimedia::MediaPlayer::playbackRate | |
int | loops |
Determines how often the media is played before the player stops. | |
PlaybackState | playbackState |
Returns the \l{QMediaPlayer::}{PlaybackState}. | |
MediaStatus | mediaStatus |
the status of the current media stream. | |
QMediaMetaData | metaData |
\qmlproperty mediaMetaData QtMultimedia::MediaPlayer::metaData | |
Error | error |
a string describing the last error condition. | |
QString | errorString |
\qmlproperty string QtMultimedia::MediaPlayer::errorString | |
QObject * | videoOutput |
\qmlproperty VideoOutput QtMultimedia::MediaPlayer::videoOutput | |
QAudioOutput * | audioOutput |
\qmlproperty AudioOutput QtMultimedia::MediaPlayer::audioOutput | |
QList< QMediaMetaData > | audioTracks |
\qmlproperty list<mediaMetaData> QtMultimedia::MediaPlayer::audioTracks | |
QList< QMediaMetaData > | videoTracks |
\qmlproperty list<mediaMetaData> QtMultimedia::MediaPlayer::videoTracks | |
QList< QMediaMetaData > | subtitleTracks |
\qmlproperty list<mediaMetaData> QtMultimedia::MediaPlayer::subtitleTracks | |
int | activeAudioTrack |
\qmlproperty int QtMultimedia::MediaPlayer::activeAudioTrack | |
int | activeVideoTrack |
Returns the currently active video track. | |
int | activeSubtitleTrack |
Returns the currently active subtitle track. | |
![]() | |
QString | objectName |
the name of this object | |
Friends | |
class | QPlatformMediaPlayer |
Additional Inherited Members | |
![]() | |
static QMetaObject::Connection | connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection) |
\threadsafe | |
static QMetaObject::Connection | connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection) |
template<typename Func1 , typename Func2 > | |
static QMetaObject::Connection | connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot) |
static bool | disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member) |
\threadsafe | |
static bool | disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member) |
static bool | disconnect (const QMetaObject::Connection &) |
Disconnect a connection. | |
template<typename Func1 , typename Func2 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot) |
template<typename Func1 > | |
static bool | disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero) |
![]() | |
QObject * | sender () const |
Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr. | |
int | senderSignalIndex () const |
int | receivers (const char *signal) const |
Returns the number of receivers connected to the signal. | |
bool | isSignalConnected (const QMetaMethod &signal) const |
virtual void | timerEvent (QTimerEvent *event) |
This event handler can be reimplemented in a subclass to receive timer events for the object. | |
virtual void | childEvent (QChildEvent *event) |
This event handler can be reimplemented in a subclass to receive child events. | |
virtual void | customEvent (QEvent *event) |
This event handler can be reimplemented in a subclass to receive custom events. | |
virtual void | connectNotify (const QMetaMethod &signal) |
virtual void | disconnectNotify (const QMetaMethod &signal) |
QObject (QObjectPrivate &dd, QObject *parent=nullptr) | |
![]() | |
QScopedPointer< QObjectData > | d_ptr |
![]() | |
template< class T > T | qobject_cast (const QObject *object) |
Returns the given object cast to type T if the object is of type T (or of a subclass); otherwise returns \nullptr. | |
template< typename T > T | qFindChildqFindChildren (const QObject *obj, const QString &name)() |
template< typename T > QList< T > | qFindChildrenqFindChildren (const QObject *obj, const QString &name)() |
QObjectList | |
\macro Q_CLASSINFO(Name, Value) | |
The QMediaPlayer class allows the playing of a media files.
\inmodule QtMultimedia
The QMediaPlayer class is a high level media playback class. It can be used to playback audio of video media files. The content to playback is specified as a QUrl object.
QVideoWidget can be used with QMediaPlayer for video rendering.
Definition at line 22 of file qmediaplayer.h.
enum QMediaPlayer::Error |
\qmlproperty enumeration QtMultimedia::MediaPlayer::mediaStatus
This property holds the status of media loading. It can be one of the following:
\table \header
\qmlproperty enumeration QtMultimedia::MediaPlayer::error
This property holds the error state of the audio. It can be one of the following.
\table \header
Defines a media player error condition.
\value NoError No error has occurred. \value ResourceError A media resource couldn't be resolved. \value FormatError The format of a media resource isn't (fully) supported. Playback may still be possible, but without an audio or video component. \value NetworkError A network error occurred. \value AccessDeniedError There are not the appropriate permissions to play a media resource.
Enumerator | |
---|---|
NoError | |
ResourceError | |
FormatError | |
NetworkError | |
AccessDeniedError |
Definition at line 77 of file qmediaplayer.h.
enum QMediaPlayer::Loops |
Some predefined constants for the \l loops property.
\value Infinite Loop forever. \value Once Play the media once (the default).
Enumerator | |
---|---|
Infinite | |
Once |
Definition at line 87 of file qmediaplayer.h.
\qmlproperty enumeration QtMultimedia::MediaPlayer::playbackState
This property holds the state of media playback. It can be one of the following:
\table \header
\qmlsignal QtMultimedia::MediaPlayer::playbackStateChanged()
This signal is emitted when the \l playbackState property is altered.
Defines the status of a media player's current media.
\value NoMedia The is no current media. The player is in the StoppedState. \value LoadingMedia The current media is being loaded. The player may be in any state. \value LoadedMedia The current media has been loaded. The player is in the StoppedState. \value StalledMedia Playback of the current media has stalled due to insufficient buffering or some other temporary interruption. The player is in the PlayingState or PausedState. \value BufferingMedia The player is buffering data but has enough data buffered for playback to continue for the immediate future. The player is in the PlayingState or PausedState. \value BufferedMedia The player has fully buffered the current media. The player is in the PlayingState or PausedState. \value EndOfMedia Playback has reached the end of the current media. The player is in the StoppedState. \value InvalidMedia The current media cannot be played. The player is in the StoppedState.
Enumerator | |
---|---|
NoMedia | |
LoadingMedia | |
LoadedMedia | |
StalledMedia | |
BufferingMedia | |
BufferedMedia | |
EndOfMedia | |
InvalidMedia |
Definition at line 64 of file qmediaplayer.h.
Defines the current state of a media player.
\value StoppedState The media player is not playing content, playback will begin from the start of the current track. \value PlayingState The media player is currently playing content. This indicates the same as the \l playing property. \value PausedState The media player has paused playback, playback of the current track will resume from the position the player was paused at.
Enumerator | |
---|---|
StoppedState | |
PlayingState | |
PausedState |
Definition at line 56 of file qmediaplayer.h.
Constructs a QMediaPlayer instance as a child of {parent}.
Definition at line 228 of file qmediaplayer.cpp.
References QPlatformMediaIntegration::createPlayer(), d, QPlatformMediaIntegration::instance(), qWarning, and ResourceError.
QMediaPlayer::~QMediaPlayer | ( | ) |
Destroys the player object.
Definition at line 248 of file qmediaplayer.cpp.
References d, disconnect(), and setAudioOutput().
int QMediaPlayer::activeAudioTrack | ( | ) | const |
Definition at line 791 of file qmediaplayer.cpp.
References QPlatformMediaPlayer::AudioStream, and d.
int QMediaPlayer::activeSubtitleTrack | ( | ) | const |
Definition at line 839 of file qmediaplayer.cpp.
References d, and QPlatformMediaPlayer::SubtitleStream.
|
signal |
Referenced by QPlatformMediaPlayer::activeTracksChanged().
int QMediaPlayer::activeVideoTrack | ( | ) | const |
Definition at line 815 of file qmediaplayer.cpp.
References d, and QPlatformMediaPlayer::VideoStream.
QAudioOutput * QMediaPlayer::audioOutput | ( | ) | const |
Definition at line 687 of file qmediaplayer.cpp.
References d.
|
signal |
QList< QMediaMetaData > QMediaPlayer::audioTracks | ( | ) | const |
Definition at line 716 of file qmediaplayer.cpp.
References QPlatformMediaPlayer::AudioStream, and d.
QMediaTimeRange QMediaPlayer::bufferedTimeRange | ( | ) | const |
Returns a QMediaTimeRange describing the currently buffered data.
When streaming media from a remote source, different parts of the media file can be available locally. The returned QMediaTimeRange object describes the time ranges that are buffered and available for immediate playback.
Definition at line 361 of file qmediaplayer.cpp.
References d.
float QMediaPlayer::bufferProgress | ( | ) | const |
Returns a number between 0 and 1 when buffering data.
0 means that there is no buffered data available, playback is usually stalled in this case. Playback will resume once the buffer reaches 1, meaning enough data has been buffered to be able to resume playback.
bufferProgress() will always return 1 for local files.
Definition at line 346 of file qmediaplayer.cpp.
References d.
|
signal |
Signals the amount of the local buffer filled as a number between 0 and 1.
Referenced by QPlatformMediaPlayer::bufferProgressChanged().
qint64 QMediaPlayer::duration | ( | ) | const |
Returns the duration of the current media in ms.
Returns 0 if the media player doesn't have a valid media file or stream. For live streams, the duration usually changes during playback as more data becomes available.
Definition at line 318 of file qmediaplayer.cpp.
References d.
Signals the duration of the content has changed to duration, expressed in milliseconds.
Referenced by QPlatformMediaPlayer::durationChanged().
QMediaPlayer::Error QMediaPlayer::error | ( | ) | const |
Returns the current error state.
Definition at line 470 of file qmediaplayer.cpp.
|
signal |
|
signal |
\qmlsignal QtMultimedia::MediaPlayer::errorOccurred(error, errorString)
This signal is emitted when an error has occurred. The errorString parameter may contain more detailed information about the error.
Signals that an error condition has occurred, with errorString containing a description of the error.
QString QMediaPlayer::errorString | ( | ) | const |
Definition at line 487 of file qmediaplayer.cpp.
bool QMediaPlayer::hasAudio | ( | ) | const |
Definition at line 377 of file qmediaplayer.cpp.
References d.
|
signal |
Signals the availability of audio content has changed to available.
Referenced by QPlatformMediaPlayer::audioAvailableChanged().
bool QMediaPlayer::hasVideo | ( | ) | const |
Definition at line 393 of file qmediaplayer.cpp.
References d.
|
signal |
Signals the availability of visual content has changed to videoAvailable.
Referenced by QPlatformMediaPlayer::videoAvailableChanged().
bool QMediaPlayer::isAvailable | ( | ) | const |
Returns true if the media player is supported on this platform.
Definition at line 959 of file qmediaplayer.cpp.
References d.
bool QMediaPlayer::isPlaying | ( | ) | const |
Definition at line 411 of file qmediaplayer.cpp.
References d, and PlayingState.
bool QMediaPlayer::isSeekable | ( | ) | const |
Returns true if the media is seekable.
Most file based media files are seekable, but live streams usually are not.
Definition at line 405 of file qmediaplayer.cpp.
References d.
int QMediaPlayer::loops | ( | ) | const |
\qmlproperty int QtMultimedia::MediaPlayer::loops
Determines how often the media is played before the player stops. Set to MediaPlayer::Infinite to loop the current media file forever.
The default value is 1
. Setting this property to 0
has no effect.
Definition at line 452 of file qmediaplayer.cpp.
References d.
|
signal |
QMediaPlayer::MediaStatus QMediaPlayer::mediaStatus | ( | ) | const |
Definition at line 305 of file qmediaplayer.cpp.
|
signal |
Signals that the status of the current media has changed.
QMediaMetaData QMediaPlayer::metaData | ( | ) | const |
Definition at line 986 of file qmediaplayer.cpp.
References d.
|
signal |
|
slot |
\qmlmethod QtMultimedia::MediaPlayer::pause()
Pauses playback of the media.
Sets the \l playbackState property to PausedState, and changes \l playing to false
.
Pause playing the current source.
Definition at line 533 of file qmediaplayer.cpp.
References d.
|
slot |
\qmlmethod QtMultimedia::MediaPlayer::play()
Starts or resumes playback of the media.
Sets the \l playbackState property to PlayingState, and changes \l playing to true
.
Start or resume playing the current source.
Definition at line 506 of file qmediaplayer.cpp.
Referenced by VideoExample::VideoGraphicsItem(), and VideoExample::VideoWidget().
qreal QMediaPlayer::playbackRate | ( | ) | const |
Signals the playbackRate has changed to rate.
Referenced by QPlatformMediaPlayer::playbackRateChanged().
QMediaPlayer::PlaybackState QMediaPlayer::playbackState | ( | ) | const |
Definition at line 290 of file qmediaplayer.cpp.
References d, and EndOfMedia.
|
signal |
|
signal |
qint64 QMediaPlayer::position | ( | ) | const |
Returns the current position inside the media being played back in ms.
Returns 0 if the media player doesn't have a valid media file or stream. For live streams, the duration usually changes during playback as more data becomes available.
Definition at line 331 of file qmediaplayer.cpp.
References d.
Signals the position of the content has changed to position, expressed in milliseconds.
Referenced by QPlatformMediaPlayer::positionChanged().
|
signal |
Signals the seekable status of the player object has changed.
Referenced by QPlatformMediaPlayer::seekableChanged().
void QMediaPlayer::setActiveAudioTrack | ( | int | index | ) |
Definition at line 845 of file qmediaplayer.cpp.
References activeAudioTrack, QPlatformMediaPlayer::AudioStream, and d.
void QMediaPlayer::setActiveSubtitleTrack | ( | int | index | ) |
Definition at line 867 of file qmediaplayer.cpp.
References activeSubtitleTrack, d, and QPlatformMediaPlayer::SubtitleStream.
void QMediaPlayer::setActiveVideoTrack | ( | int | index | ) |
Definition at line 856 of file qmediaplayer.cpp.
References activeVideoTrack, d, and QPlatformMediaPlayer::VideoStream.
void QMediaPlayer::setAudioOutput | ( | QAudioOutput * | output | ) |
Definition at line 668 of file qmediaplayer.cpp.
References audioOutputChanged(), d, emit, output, and setAudioOutput().
Referenced by ~QMediaPlayer(), and setAudioOutput().
void QMediaPlayer::setLoops | ( | int | loops | ) |
Definition at line 458 of file qmediaplayer.cpp.
Definition at line 574 of file qmediaplayer.cpp.
References d.
Definition at line 563 of file qmediaplayer.cpp.
References d, position, and qMax().
\qmlproperty url QtMultimedia::MediaPlayer::source
This property holds the source URL of the media.
Sets the current source.
Setting the media to a null QUrl will cause the player to discard all information relating to the current media source and to cease all I/O operations related to that media.
Definition at line 605 of file qmediaplayer.cpp.
References d, emit, source, sourceChanged(), and stop().
Referenced by QQuickMediaPlayer::qmlSetSource(), VideoExample::VideoGraphicsItem(), and VideoExample::VideoWidget().
Sets the current source device.
The media data will be read from device. The sourceUrl can be provided to resolve additional information about the media, mime type etc. The device must be open and readable.
For macOS the device should also be seek-able.
Definition at line 634 of file qmediaplayer.cpp.
References d, device, emit, sourceChanged(), and stop().
Definition at line 903 of file qmediaplayer.cpp.
References d, mo, output, and Q_RETURN_ARG.
Referenced by VideoExample::VideoGraphicsItem(), and VideoExample::VideoWidget().
void QMediaPlayer::setVideoSink | ( | QVideoSink * | sink | ) |
Sets sink to be the QVideoSink instance to retrieve video data.
Definition at line 922 of file qmediaplayer.cpp.
References d.
Referenced by QVideoSinkPrivate::unregisterSource().
QUrl QMediaPlayer::source | ( | ) | const |
Definition at line 261 of file qmediaplayer.cpp.
References d.
Signals that the media source has been changed to media.
Referenced by setSource(), and setSourceDevice().
const QIODevice * QMediaPlayer::sourceDevice | ( | ) | const |
Returns the stream source of media data.
This is only valid if a stream was passed to setSource().
Definition at line 276 of file qmediaplayer.cpp.
References d.
|
slot |
\qmlmethod QtMultimedia::MediaPlayer::stop()
Stops playback of the media.
Sets the \l playbackState property to StoppedState, and changes \l playing to false
.
Stop playing, and reset the play position to the beginning.
Definition at line 555 of file qmediaplayer.cpp.
References d.
Referenced by setSource(), setSourceDevice(), and VideoExample::VideoWidget().
QList< QMediaMetaData > QMediaPlayer::subtitleTracks | ( | ) | const |
Definition at line 768 of file qmediaplayer.cpp.
References d, and QPlatformMediaPlayer::SubtitleStream.
|
signal |
QObject * QMediaPlayer::videoOutput | ( | ) | const |
Definition at line 897 of file qmediaplayer.cpp.
References d.
|
signal |
QVideoSink * QMediaPlayer::videoSink | ( | ) | const |
QList< QMediaMetaData > QMediaPlayer::videoTracks | ( | ) | const |
Definition at line 741 of file qmediaplayer.cpp.
References d, and QPlatformMediaPlayer::VideoStream.
|
friend |
Definition at line 190 of file qmediaplayer.h.
|
readwrite |
\qmlproperty int QtMultimedia::MediaPlayer::activeAudioTrack
This property holds the track number of the currently active audio track. Set to {-1} to disable audio track.
The default property value is {0}: the first audio track.
Returns the currently active audio track.
By default, the first available audio track will be chosen.
Set index to -1
to disable all audio tracks.
Definition at line 193 of file qmediaplayer.h.
Referenced by setActiveAudioTrack().
|
readwrite |
Returns the currently active subtitle track.
This property holds the track number of the currently active subtitle track. Set to {-1} to disable subtitle track.
The default property value is {-1}: no subtitles active.
Set index to -1
to disable subtitles.
Subtitles are disabled by default.
Definition at line 193 of file qmediaplayer.h.
Referenced by setActiveSubtitleTrack().
|
readwrite |
Returns the currently active video track.
This property holds the track number of the currently active video audio track. Set to {-1} to disable video track.
The default property value is {0}: the first video track.
By default, the first available audio track will be chosen.
Set index to -1
to disable all video tracks.
Definition at line 193 of file qmediaplayer.h.
Referenced by setActiveVideoTrack().
|
readwrite |
\qmlproperty AudioOutput QtMultimedia::MediaPlayer::audioOutput
This property holds the target audio output. Accepts one AudioOutput elements.
The audio output device used by the media player.
The current audio output to be used when playing back media. Setting a new audio output will replace the currently used output.
Setting this property to nullptr
will disable any audio output.
Definition at line 193 of file qmediaplayer.h.
|
read |
\qmlproperty list<mediaMetaData> QtMultimedia::MediaPlayer::audioTracks
This property holds a list of metadata. Each index refers to an audio track.
The metadata holds properties describing the individual tracks. For audio tracks the \l{QMediaMetaData}{Language} is usually the most important property.
Lists the set of available audio tracks inside the media.
The QMediaMetaData returned describes the properties of individual tracks.
Different audio tracks can for example contain audio in different languages.
Definition at line 193 of file qmediaplayer.h.
|
read |
\qmlproperty real QtMultimedia::MediaPlayer::bufferProgress
This property holds how much of the data buffer is currently filled, from 0.0
(empty) to 1.0
(full).
Playback can start or resume only when the buffer is entirely filled. When the buffer is filled, MediaPlayer.Buffered
is true. When buffer progress is between 0.0
and 0.1
, MediaPlayer.Buffering
is set to {true}.
A value lower than 1.0
implies that the property MediaPlayer.StalledMedia
is {true}.
the percentage of the temporary buffer filled before playback begins or resumes, from 0
. (empty) to 1
. (full).
When the player object is buffering; this property holds the percentage of the temporary buffer that is filled. The buffer will need to reach 100% filled before playback can start or resume, at which time mediaStatus() will return BufferedMedia or BufferingMedia. If the value is anything lower than 100
, mediaStatus() will return StalledMedia.
Definition at line 193 of file qmediaplayer.h.
|
read |
\qmlproperty int QtMultimedia::MediaPlayer::duration
This property holds the duration of the media in milliseconds.
If the media doesn't have a fixed duration (a live stream for example) this will be set to {0}.
the duration of the current media.
The value is the total playback time in milliseconds of the current media. The value may change across the life time of the QMediaPlayer object and may not be available when initial playback begins, connect to the durationChanged() signal to receive status notifications.
Definition at line 193 of file qmediaplayer.h.
|
read |
a string describing the last error condition.
Definition at line 193 of file qmediaplayer.h.
|
read |
\qmlproperty string QtMultimedia::MediaPlayer::errorString
This property holds a string describing the current error condition in more detail.
This property holds a string describing the current error condition in more detail.
Definition at line 193 of file qmediaplayer.h.
|
read |
\qmlproperty bool QtMultimedia::MediaPlayer::hasAudio
This property holds whether the media contains audio.
This property holds whether the media contains audio.
Definition at line 193 of file qmediaplayer.h.
|
read |
\qmlproperty bool QtMultimedia::MediaPlayer::hasVideo
This property holds whether the media contains video.
This property holds whether the media contains video.
Definition at line 193 of file qmediaplayer.h.
|
readwrite |
Determines how often the media is played before the player stops.
Set to QMediaPlayer::Infinite to loop the current media file forever.
The default value is 1
. Setting this property to 0
has no effect.
Definition at line 193 of file qmediaplayer.h.
Referenced by setLoops().
|
read |
the status of the current media stream.
The stream status describes how the playback of the current stream is progressing.
By default this property is QMediaPlayer::NoMedia
Definition at line 193 of file qmediaplayer.h.
|
read |
\qmlproperty mediaMetaData QtMultimedia::MediaPlayer::metaData
Returns meta data for the current media used by the media player.
Meta data can contain information such as the title of the video or its creation date.
Returns meta data for the current media used by the media player.
Meta data can contain information such as the title of the video or its creation date.
Definition at line 193 of file qmediaplayer.h.
|
readwrite |
\qmlproperty real QtMultimedia::MediaPlayer::playbackRate
This property holds the rate at which audio is played at as a multiple of the normal rate.
Defaults to {1.0}.
the playback rate of the current media.
This value is a multiplier applied to the media's standard play rate. By default this value is 1.0, indicating that the media is playing at the standard pace. Values higher than 1.0 will increase the rate of play. Values less than zero can be set and indicate the media should rewind at the multiplier of the standard pace.
Not all playback services support change of the playback rate. It is framework defined as to the status and quality of audio and video while fast forwarding or rewinding.
Definition at line 193 of file qmediaplayer.h.
|
read |
Returns the \l{QMediaPlayer::}{PlaybackState}.
Definition at line 193 of file qmediaplayer.h.
|
read |
\qmlproperty bool QtMultimedia::MediaPlayer::playing
Indicates whether the media is currently playing.
Whether the media is playing.
Definition at line 193 of file qmediaplayer.h.
|
readwrite |
\qmlproperty int QtMultimedia::MediaPlayer::position
The value is the current playback position, expressed in milliseconds since the beginning of the media. Periodically changes in the position will be indicated with the positionChanged() signal.
If the \l seekable property is true, this property can be set to milliseconds.
the playback position of the current media.
The value is the current playback position, expressed in milliseconds since the beginning of the media. Periodically changes in the position will be indicated with the positionChanged() signal.
If the \l seekable property is true, this property can be set to milliseconds.
Definition at line 193 of file qmediaplayer.h.
Referenced by setPosition().
|
read |
\qmlproperty bool QtMultimedia::MediaPlayer::seekable
This property holds whether the \l position of the media can be changed.
the seek-able status of the current media
If seeking is supported this property will be true; false otherwise. The status of this property may change across the life time of the QMediaPlayer object, use the seekableChanged signal to monitor changes.
Definition at line 193 of file qmediaplayer.h.
|
readwrite |
the active media source being used by the player object.
The player object will use the QUrl for selection of the content to be played.
By default this property has a null QUrl.
Setting this property to a null QUrl will cause the player to discard all information relating to the current media source and to cease all I/O operations related to that media.
Definition at line 193 of file qmediaplayer.h.
Referenced by setSource().
|
read |
\qmlproperty list<mediaMetaData> QtMultimedia::MediaPlayer::subtitleTracks
This property holds a list of metadata. Each index refers to a subtitle track.
The metadata holds properties describing the individual tracks. For subtitle tracks the \l{QMediaMetaData}{Language} is usually the most important property.
Lists the set of available subtitle tracks inside the media.
The QMediaMetaData returned describes the properties of individual tracks.
Definition at line 193 of file qmediaplayer.h.
|
readwrite |
\qmlproperty VideoOutput QtMultimedia::MediaPlayer::videoOutput
This property holds the target video output. Accepts one VideoOutput elements.
The video output to be used by the media player.
A media player can only have one video output attached, so setting this property will replace the previously connected video output.
Setting this property to nullptr
will disable video output.
Definition at line 193 of file qmediaplayer.h.
|
read |
\qmlproperty list<mediaMetaData> QtMultimedia::MediaPlayer::videoTracks
This property holds a list of metadata. Each index refers to a video track.
The metadata holds properties describing the individual tracks.
Lists the set of available video tracks inside the media.
The QMediaMetaData returned describes the properties of individual tracks.
Definition at line 193 of file qmediaplayer.h.