CopperSpice API  1.7.2
QMediaPlayerControl Class Referenceabstract

The QMediaPlayerControl class provides access to the media playing functionality of a QMediaService. More...

Inheritance diagram for QMediaPlayerControl:
QMediaControl QObject

Public Signals

void audioAvailableChanged (bool audioAvailable)
 
void availablePlaybackRangesChanged (const QMediaTimeRange &un_named_arg1)
 
void bufferStatusChanged (int percentFilled)
 
void durationChanged (qint64 duration)
 
void error (int error, const QString &errorString)
 
void mediaChanged (const QMediaContent &content)
 
void mediaStatusChanged (QMediaPlayer::MediaStatus status)
 
void mutedChanged (bool muted)
 
void playbackRateChanged (qreal rate)
 
void positionChanged (qint64 position)
 
void seekableChanged (bool un_named_arg1)
 
void stateChanged (QMediaPlayer::State newState)
 
void videoAvailableChanged (bool videoAvailable)
 
void volumeChanged (int volume)
 
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 

Public Methods

 ~QMediaPlayerControl ()
 
virtual QMediaTimeRange availablePlaybackRanges () const = 0
 
virtual int bufferStatus () const = 0
 
virtual qint64 duration () const = 0
 
virtual bool isAudioAvailable () const = 0
 
virtual bool isMuted () const = 0
 
virtual bool isSeekable () const = 0
 
virtual bool isVideoAvailable () const = 0
 
virtual QMediaContent media () const = 0
 
virtual QMediaPlayer::MediaStatus mediaStatus () const = 0
 
virtual const QIODevicemediaStream () const = 0
 
virtual void pause () = 0
 
virtual void play () = 0
 
virtual qreal playbackRate () const = 0
 
virtual qint64 position () const = 0
 
virtual void setMedia (const QMediaContent &media, QIODevice *stream) = 0
 
virtual void setMuted (bool muted) = 0
 
virtual void setPlaybackRate (qreal rate) = 0
 
virtual void setPosition (qint64 position) = 0
 
virtual void setVolume (int volume) = 0
 
virtual QMediaPlayer::State state () const = 0
 
virtual void stop () = 0
 
virtual int volume () const = 0
 
- Public Methods inherited from QMediaControl
 ~QMediaControl ()
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &objName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 

Protected Methods

 QMediaPlayerControl (QObject *parent=nullptr)
 
- Protected Methods inherited from QMediaControl
 QMediaControl (QObject *parent=nullptr)
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 

Additional Inherited Members

- Public Slots inherited from QObject
void deleteLater ()
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 
- Properties inherited from QObject
 objectName
 

Detailed Description

If a QMediaService can play media is will implement QMediaPlayerControl. This control provides a means to set the setMedia() to play, play(), pause() and stop() playback, setPosition(), and control the setVolume(). It also provides feedback on the duration() of the media, the current position(), and bufferStatus() progress.

The functionality provided by this control is exposed to application code through the QMediaPlayer class.

The interface name of QMediaPlayerControl is "com.copperspice.CS.mediaPlayerControl/1.0" as defined in QMediaPlayerControl_ID.

See also
QMediaService::requestControl(), QMediaPlayer

Constructor & Destructor Documentation

QMediaPlayerControl::~QMediaPlayerControl ( )

Destroys a media player control.

QMediaPlayerControl::QMediaPlayerControl ( QObject parent = nullptr)
explicitprotected

Constructs a new media player control with the given parent.

Method Documentation

void QMediaPlayerControl::audioAvailableChanged ( bool  audio)
signal

Signals that there has been a change in the availability of audio output.

See also
isAudioAvailable()
QMediaTimeRange QMediaPlayerControl::availablePlaybackRanges ( ) const
pure virtual

Returns a range of times in milliseconds that can be played back.

Usually for local files this is a continuous interval equal to [0..duration()] or an empty time range if seeking is not supported, but for network sources it refers to the buffered parts of the media.

void QMediaPlayerControl::availablePlaybackRangesChanged ( const QMediaTimeRange ranges)
signal

Signals that the available media playback ranges have changed.

See also
QMediaPlayerControl::availablePlaybackRanges()
int QMediaPlayerControl::bufferStatus ( ) const
pure virtual

Returns the buffering progress of the current media. Progress is measured in the percentage of the buffer filled.

void QMediaPlayerControl::bufferStatusChanged ( int  progress)
signal

Signals that buffering progress has changed.

See also
bufferStatus()
qint64 QMediaPlayerControl::duration ( ) const
pure virtual

Returns the duration of the current media in milliseconds.

void QMediaPlayerControl::durationChanged ( qint64  duration)
signal

Signals that the duration of the current media has changed.

See also
duration()
void QMediaPlayerControl::error ( int  error,
const QString errorString 
)
signal

Signals that an error has occurred. The errorString provides a more detailed explanation.

bool QMediaPlayerControl::isAudioAvailable ( ) const
pure virtual

Identifies if there is audio output available for the current media. Returns true if audio output is available and false otherwise.

bool QMediaPlayerControl::isMuted ( ) const
pure virtual

Returns the mute state of a player control.

bool QMediaPlayerControl::isSeekable ( ) const
pure virtual

Identifies if the current media is seekable. Returns true if it possible to seek within the current media, and false otherwise.

bool QMediaPlayerControl::isVideoAvailable ( ) const
pure virtual

Identifies if there is video output available for the current media. Returns true if video output is available and false otherwise.

QMediaContent QMediaPlayerControl::media ( ) const
pure virtual

Returns the current media source.

void QMediaPlayerControl::mediaChanged ( const QMediaContent content)
signal

Signals that the current media content has changed.

QMediaPlayer::MediaStatus QMediaPlayerControl::mediaStatus ( ) const
pure virtual

Returns the status of the current media.

void QMediaPlayerControl::mediaStatusChanged ( QMediaPlayer::MediaStatus  status)
signal

Signals that the status of the current media has changed.

See also
mediaStatus()
const QIODevice * QMediaPlayerControl::mediaStream ( ) const
pure virtual

Returns the current media stream. This is only a valid if a stream was passed to setMedia().

See also
setMedia()
void QMediaPlayerControl::mutedChanged ( bool  mute)
signal

Signals a change in the mute status of a player control.

See also
isMuted()
void QMediaPlayerControl::pause ( )
pure virtual

Pauses playback of the current media. If successful the player control will immediately enter the QMediaPlayer::PausedState state.

See also
state(), play(), stop()
void QMediaPlayerControl::play ( )
pure virtual

Starts playback of the current media. If successful the player control will immediately enter the QMediaPlayer::PlayingState state.

See also
state()
qreal QMediaPlayerControl::playbackRate ( ) const
pure virtual

Returns the rate of playback.

void QMediaPlayerControl::playbackRateChanged ( qreal  rate)
signal

Signal emitted when playback rate changes to rate.

qint64 QMediaPlayerControl::position ( ) const
pure virtual

Returns the current playback position in milliseconds.

void QMediaPlayerControl::positionChanged ( qint64  position)
signal

Signals the playback position has changed. This is only emitted in when there has been a discontinuous change in the playback position, such as a seek or the position being reset.

See also
position()
void QMediaPlayerControl::seekableChanged ( bool  seekable)
signal

Signals that the seekable state of a player control has changed.

See also
isSeekable()
void QMediaPlayerControl::setMedia ( const QMediaContent media,
QIODevice stream 
)
pure virtual

Sets the current media source. If a stream is supplied; data will be read from that instead of attempting to resolve the media source. The media source may still be used to supply media information such as mime type.

Setting the media to a null QMediaContent will cause the control to discard all information relating to the current media source and to cease all I/O operations related to that media.

Resource files are never passed directly. If the service supports QMediaServiceProviderHint::StreamPlayback, a stream is supplied, pointing to an opened QFile. Otherwise the resource is copied into a temporary file and media contains a url pointing to the file.

void QMediaPlayerControl::setMuted ( bool  mute)
pure virtual

Sets the mute state of a player control.

void QMediaPlayerControl::setPlaybackRate ( qreal  rate)
pure virtual

Sets the rate of playback.

void QMediaPlayerControl::setPosition ( qint64  position)
pure virtual

Sets the playback position of the current media. This will initiate a seek and it may take some time for playback to reach the position set.

void QMediaPlayerControl::setVolume ( int  volume)
pure virtual

Sets the audio volume of a player control.

QMediaPlayer::State QMediaPlayerControl::state ( ) const
pure virtual

Returns the state of a player control.

void QMediaPlayerControl::stateChanged ( QMediaPlayer::State  state)
signal

Signals that the state of a player control has changed.

See also
state()
void QMediaPlayerControl::stop ( )
pure virtual

Stops playback of the current media. If successful the player control will immediately enter the QMediaPlayer::StoppedState state.

void QMediaPlayerControl::videoAvailableChanged ( bool  video)
signal

Signals that there has been a change in the availability of video output.

See also
isVideoAvailable()
int QMediaPlayerControl::volume ( ) const
pure virtual

Returns the audio volume of a player control.

void QMediaPlayerControl::volumeChanged ( int  volume)
signal

Signals the audio volume of a player control has changed.

See also
volume()