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  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QMediaPlaylist Class Reference

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

    #include <QMediaPlaylist>

This class is under development and is subject to change.

Inherits QObject.


Public Types

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

Properties

  • 1 property inherited from QObject

Public Functions

QMediaPlaylist ( QMediaObject * mediaObject = 0, QObject * parent = 0 )
virtual ~QMediaPlaylist ()
bool appendItem ( const QMediaContent & content )
bool appendItems ( const QList<QMediaContent> & items )
bool clear ()
QMediaContent currentMedia () const
int currentPosition () const
Error error () const
QString errorString () const
bool insertItem ( int pos, const QMediaContent & content )
bool insertItems ( int pos, const QList<QMediaContent> & items )
bool isEmpty () const
bool isReadOnly () const
void load ( const QUrl & location, const char * format = 0 )
void load ( QIODevice * device, const char * format = 0 )
QMediaContent media ( int position ) const
int nextPosition ( int steps = 1 ) const
PlaybackMode playbackMode () const
int previousPosition ( int steps = 1 ) const
bool removeItem ( int pos )
bool removeItems ( int start, int end )
bool save ( const QUrl & location, const char * format = 0 )
bool save ( QIODevice * device, const char * format )
void setPlaybackMode ( PlaybackMode mode )
int size () const
  • 29 public functions inherited from QObject

Public Slots

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

Signals

void currentMediaChanged ( const QMediaContent & content )
void itemsAboutToBeInserted ( int start, int end )
void itemsAboutToBeRemoved ( int start, int end )
void itemsChanged ( int start, int end )
void itemsInserted ( int start, int end )
void itemsRemoved ( int start, int end )
void loadFailed ()
void loaded ()
void playbackModeChanged ( QMediaPlaylist::PlaybackMode mode )
void playlistPositionChanged ( int position )

Additional Inherited Members

  • 1 public type inherited from QObject
  • 4 static public members inherited from QObject
  • 7 protected functions inherited from QObject
  • 2 protected variables 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 or QMediaImageViewer. QMediaPlaylist allows to access the service intrinsic playlist functionality if available, otherwise it provides the the local memory playlist implementation.

    player = new QMediaPlayer;

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

    playlist->setCurrentPosition(1);

    player->play();

Depending on playlist source implementation, most of playlist modifcation 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 in the loop.
QMediaPlaylist::Linear2Playback starts from the first to the last items and stops. next item is a null item when the last one is currently playing.
QMediaPlaylist::Loop3Playback continues from the first item after the last one finished playing.
QMediaPlaylist::Random4Play items in random order.


Property Documentation

currentMedia : const QMediaContent

This property holds current media content.

Access functions:

QMediaContent currentMedia () const

Notifier signal:

void currentMediaChanged ( const QMediaContent & content )

currentPosition : int

This property holds current position.

Access functions:

int currentPosition () const
void setCurrentPosition ( int playlistPosition )

Notifier signal:

void playlistPositionChanged ( int position )

playbackMode : QMediaPlaylist::PlaybackMode

This property defines the order, items in 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 ( QMediaObject * mediaObject = 0, QObject * parent = 0 )

Create a new playlist object for with the given parent. If mediaObject is null or doesn't have an intrinsic playlist, internal local memory playlist source will be created.

QMediaPlaylist::~QMediaPlaylist ()   [virtual]

Destroys the playlist.

bool QMediaPlaylist::appendItem ( const QMediaContent & content )

Append the media content to the playlist.

Returns true if the operation is successfull, other wise return false.

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

Append multiple media content items to the playlist.

Returns true if the operation is successfull, other wise return false.

bool QMediaPlaylist::clear ()

Remove all the items from the playlist.

Returns true if the operation is successfull, other wise return false.

void QMediaPlaylist::currentMediaChanged ( const QMediaContent & content )   [signal]

Signal emitted when current media changes to content.

Error QMediaPlaylist::error () const

Returns the last error condition.

QString QMediaPlaylist::errorString () const

Returns the string describing the last error condition.

bool QMediaPlaylist::insertItem ( 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::insertItems ( 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 size().

bool QMediaPlaylist::isReadOnly () const

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

See also size().

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

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

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

Signal emitted when item to de deleted ar start and ending at end.

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

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

void QMediaPlaylist::itemsInserted ( 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.

void QMediaPlaylist::itemsRemoved ( 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::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.

Returns true if playlist was loaded succesfully, otherwise returns false.

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.

Returns true if playlist was loaded succesfully, otherwise returns false.

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 position ) const

Returns the media content at index position in the playlist.

void QMediaPlaylist::next ()   [slot]

Advance to the next media content in playlist.

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

Returns the position of item, which were 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::playbackModeChanged ( QMediaPlaylist::PlaybackMode mode )   [signal]

Signal emitted when playback mode changed to mode.

void QMediaPlaylist::playlistPositionChanged ( int position )   [signal]

Signal emitted when playlist position changed to position.

void QMediaPlaylist::previous ()   [slot]

Return to the previous media content in playlist.

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

Returns the position of item, which were current after calling previous() steps times.

See also QMediaPlaylist::playbackMode.

bool QMediaPlaylist::removeItem ( int pos )

Remove the item from the playlist at position pos.

Returns true if the operation is successfull, other wise return false.

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

Remove the items from the playlist from position start to end inclusive.

Returns true if the operation is successfull, other wise 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 succesfully, 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 succesfully, otherwise returns false.

void QMediaPlaylist::shuffle ()   [slot]

Shuffle items in the playlist.

int QMediaPlaylist::size () const

Returns the number of items in the playlist.

See also isEmpty().

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 94
  2. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  3. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  4. Pourquoi les programmeurs sont-ils moins payés que les gestionnaires de programmes ? Manquent-ils de pouvoir de négociation ? 42
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. 2017 : un quinquennat pour une nouvelle version du C++ ? Possible, selon Herb Sutter 9
  7. Qt Commercial : Digia organise un webinar gratuit le 27 mars sur la conception d'interfaces utilisateur et d'applications avec le framework 0
Page suivante

Le blog Digia au hasard

Logo

Une nouvelle ère d'IHM 3D pour les automobiles

Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

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 qtmobility-1.0-tp
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