Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Classes principales  ·  Annotées  ·  Classes groupées  ·  Modules  ·  Fonctions  · 

QMediaPlaylist Class

The QMediaPlaylist class provides a list of media content to play. More...

 #include <QMediaPlaylist>

Inherits: QObject and QMediaBindableInterface.

Public Types

enum Error { NoError, FormatError, FormatNotSupportedError, NetworkError, AccessDeniedError }
enum PlaybackMode { CurrentItemOnce, CurrentItemInLoop, Sequential, Loop, Random }

Properties

  • 1 property inherited from QObject

Public Functions

QMediaPlaylist(QObject * parent = 0)
virtual ~QMediaBindableInterface()
virtual ~QMediaPlaylist()
bool addMedia(const QMediaContent & content)
bool addMedia(const QList<QMediaContent> & items)
bool clear()
int currentIndex() const
QMediaContent currentMedia() const
Error error() const
QString errorString() const
bool insertMedia(int pos, const QMediaContent & content)
bool insertMedia(int pos, const QList<QMediaContent> & items)
bool isEmpty() const
bool isReadOnly() const
void load(const QNetworkRequest & request, const char * format = 0)
void load(const QUrl & location, const char * format = 0)
void load(QIODevice * device, const char * format = 0)
QMediaContent media(int index) const
int mediaCount() const
virtual QMediaObject * mediaObject() const = 0
int nextIndex(int steps = 1) const
PlaybackMode playbackMode() const
int previousIndex(int steps = 1) const
bool removeMedia(int pos)
bool removeMedia(int start, int end)
bool save(const QUrl & location, const char * format = 0)
bool save(QIODevice * device, const char * format)
void setPlaybackMode(PlaybackMode mode)

Reimplemented Public Functions

virtual QMediaObject * mediaObject() const
  • 31 public functions inherited from QObject

Public Slots

void next()
void previous()
void setCurrentIndex(int playlistPosition)
void shuffle()
  • 1 public slot inherited from QObject

Signals

void currentIndexChanged(int position)
void currentMediaChanged(const QMediaContent & content)
void loadFailed()
void loaded()
void mediaAboutToBeInserted(int start, int end)
void mediaAboutToBeRemoved(int start, int end)
void mediaChanged(int start, int end)
void mediaInserted(int start, int end)
void mediaRemoved(int start, int end)
void playbackModeChanged(QMediaPlaylist::PlaybackMode mode)

Protected Functions

virtual bool setMediaObject(QMediaObject * object) = 0
  • 9 protected functions inherited from QObject

Additional Inherited Members

  • 11 static public members inherited from QObject

Detailed Description

The QMediaPlaylist class provides a list of media content to play.

QMediaPlaylist is intended to be used with other media objects, like QMediaPlayer.

QMediaPlaylist allows to access the service intrinsic playlist functionality if available, otherwise it provides the the local memory playlist implementation.

 playlist = new QMediaPlaylist;
 playlist->addMedia(QUrl("http://example.com/movie1.mp4"));
 playlist->addMedia(QUrl("http://example.com/movie2.mp4"));
 playlist->addMedia(QUrl("http://example.com/movie3.mp4"));
 playlist->setCurrentIndex(1);

 player = new QMediaPlayer;
 player->setPlaylist(playlist);

 videoWidget = new QVideoWidget;
 player->setVideoOutput(videoWidget);
 videoWidget->show();

 player->play();

Depending on playlist source implementation, most of the playlist mutating operations can be asynchronous.

See also QMediaContent.

Member Type Documentation

enum QMediaPlaylist::Error

This enum describes the QMediaPlaylist error codes.

ConstantValueDescription
QMediaPlaylist::NoError0No errors.
QMediaPlaylist::FormatError1Format error.
QMediaPlaylist::FormatNotSupportedError2Format not supported.
QMediaPlaylist::NetworkError3Network error.
QMediaPlaylist::AccessDeniedError4Access denied error.

enum QMediaPlaylist::PlaybackMode

The QMediaPlaylist::PlaybackMode describes the order items in playlist are played.

ConstantValueDescription
QMediaPlaylist::CurrentItemOnce0The current item is played only once.
QMediaPlaylist::CurrentItemInLoop1The current item is played repeatedly in a loop.
QMediaPlaylist::Sequential2Playback starts from the current and moves through each successive item until the last is reached and then stops. The next item is a null item when the last one is currently playing.
QMediaPlaylist::Loop3Playback restarts at the first item after the last has finished playing.
QMediaPlaylist::Random4Play items in random order.

Property Documentation

currentIndex : int

This property holds current position.

Access functions:

int currentIndex() const
void setCurrentIndex(int playlistPosition)

Notifier signal:

void currentIndexChanged(int position)

currentMedia : const QMediaContent

This property holds current media content.

Access functions:

QMediaContent currentMedia() const

Notifier signal:

void currentMediaChanged(const QMediaContent & content)

playbackMode : QMediaPlaylist::PlaybackMode

This property defines the order that items in the playlist are played.

Access functions:

PlaybackMode playbackMode() const
void setPlaybackMode(PlaybackMode mode)

Notifier signal:

void playbackModeChanged(QMediaPlaylist::PlaybackMode mode)

See also QMediaPlaylist::PlaybackMode.

Member Function Documentation

QMediaPlaylist::QMediaPlaylist(QObject * parent = 0)

Create a new playlist object for with the given parent.

QMediaPlaylist::~QMediaPlaylist() [virtual]

Destroys the playlist.

bool QMediaPlaylist::addMedia(const QMediaContent & content)

Append the media content to the playlist.

Returns true if the operation is successful, otherwise return false.

bool QMediaPlaylist::addMedia(const QList<QMediaContent> & items)

Append multiple media content items to the playlist.

Returns true if the operation is successful, otherwise return false.

bool QMediaPlaylist::clear()

Remove all the items from the playlist.

Returns true if the operation is successful, otherwise return false.

Error QMediaPlaylist::error() const

Returns the last error condition.

QString QMediaPlaylist::errorString() const

Returns the string describing the last error condition.

bool QMediaPlaylist::insertMedia(int pos, const QMediaContent & content)

Insert the media content to the playlist at position pos.

Returns true if the operation is successful, otherwise false.

bool QMediaPlaylist::insertMedia(int pos, const QList<QMediaContent> & items)

Insert multiple media content items to the playlist at position pos.

Returns true if the operation is successful, otherwise false.

bool QMediaPlaylist::isEmpty() const

Returns true if the playlist contains no items; otherwise returns false.

See also mediaCount().

bool QMediaPlaylist::isReadOnly() const

Returns true if the playlist can be modified; otherwise returns false.

See also mediaCount().

void QMediaPlaylist::load(const QNetworkRequest & request, const char * format = 0)

Load playlist using network request. If format is specified, it is used, otherwise format is guessed from playlist name and data.

New items are appended to playlist.

QMediaPlaylist::loaded() signal is emitted if playlist was loaded successfully, otherwise the playlist emits loadFailed().

void QMediaPlaylist::load(const QUrl & location, const char * format = 0)

Load playlist from location. If format is specified, it is used, otherwise format is guessed from location name and data.

New items are appended to playlist.

QMediaPlaylist::loaded() signal is emitted if playlist was loaded successfully, otherwise the playlist emits loadFailed().

void QMediaPlaylist::load(QIODevice * device, const char * format = 0)

Load playlist from QIODevice device. If format is specified, it is used, otherwise format is guessed from device data.

New items are appended to playlist.

QMediaPlaylist::loaded() signal is emitted if playlist was loaded successfully, otherwise the playlist emits loadFailed().

void QMediaPlaylist::loadFailed() [signal]

Signal emitted if failed to load playlist.

void QMediaPlaylist::loaded() [signal]

Signal emitted when playlist finished loading.

QMediaContent QMediaPlaylist::media(int index) const

Returns the media content at index in the playlist.

void QMediaPlaylist::mediaAboutToBeInserted(int start, int end) [signal]

Signal emitted when items are to be inserted at start and ending at end.

void QMediaPlaylist::mediaAboutToBeRemoved(int start, int end) [signal]

Signal emitted when item are to be deleted at start and ending at end.

void QMediaPlaylist::mediaChanged(int start, int end) [signal]

This signal is emitted after media has been changed in the playlist between start and end positions inclusive.

int QMediaPlaylist::mediaCount() const

Returns the number of items in the playlist.

See also isEmpty().

void QMediaPlaylist::mediaInserted(int start, int end) [signal]

This signal is emitted after media has been inserted into the playlist. The new items are those between start and end inclusive.

QMediaObject * QMediaPlaylist::mediaObject() const [virtual]

Reimplemented from QMediaBindableInterface::mediaObject().

Returns the QMediaObject instance that this QMediaPlaylist is bound too, or 0 otherwise.

void QMediaPlaylist::mediaRemoved(int start, int end) [signal]

This signal is emitted after media has been removed from the playlist. The removed items are those between start and end inclusive.

void QMediaPlaylist::next() [slot]

Advance to the next media content in playlist.

int QMediaPlaylist::nextIndex(int steps = 1) const

Returns the index of the item, which would be current after calling next() steps times.

Returned value depends on the size of playlist, current position and playback mode.

See also QMediaPlaylist::playbackMode.

void QMediaPlaylist::previous() [slot]

Return to the previous media content in playlist.

int QMediaPlaylist::previousIndex(int steps = 1) const

Returns the index of the item, which would be current after calling previous() steps times.

See also QMediaPlaylist::playbackMode.

bool QMediaPlaylist::removeMedia(int pos)

Remove the item from the playlist at position pos.

Returns true if the operation is successful, otherwise return false.

bool QMediaPlaylist::removeMedia(int start, int end)

Remove items in the playlist from start to end inclusive.

Returns true if the operation is successful, otherwise return false.

bool QMediaPlaylist::save(const QUrl & location, const char * format = 0)

Save playlist to location. If format is specified, it is used, otherwise format is guessed from location name.

Returns true if playlist was saved successfully, otherwise returns false.

bool QMediaPlaylist::save(QIODevice * device, const char * format)

Save playlist to QIODevice device using format format.

Returns true if playlist was saved successfully, otherwise returns false.

void QMediaPlaylist::shuffle() [slot]

Shuffle items in the playlist.

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 5.0-snapshot
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web