QMediaPlaylist

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

Inheritance diagram of PySide2.QtMultimedia.QMediaPlaylist

Synopsis

Functions

Slots

Signals

Detailed Description

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 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

class PySide2.QtMultimedia.QMediaPlaylist([parent=None])
param parent:

PySide2.QtCore.QObject

Create a new playlist object with the given parent .

PySide2.QtMultimedia.QMediaPlaylist.PlaybackMode

The describes the order items in playlist are played.

Constant

Description

QMediaPlaylist.CurrentItemOnce

The current item is played only once.

QMediaPlaylist.CurrentItemInLoop

The current item is played repeatedly in a loop.

QMediaPlaylist.Sequential

Playback 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.Loop

Playback restarts at the first item after the last has finished playing.

QMediaPlaylist.Random

Play items in random order.

PySide2.QtMultimedia.QMediaPlaylist.Error

This enum describes the QMediaPlaylist error codes.

Constant

Description

QMediaPlaylist.NoError

No errors.

QMediaPlaylist.FormatError

Format error.

QMediaPlaylist.FormatNotSupportedError

Format not supported.

QMediaPlaylist.NetworkError

Network error.

QMediaPlaylist.AccessDeniedError

Access denied error.

PySide2.QtMultimedia.QMediaPlaylist.addMedia(items)
Parameters:

items

Return type:

bool

PySide2.QtMultimedia.QMediaPlaylist.addMedia(content)
Parameters:

contentPySide2.QtMultimedia.QMediaContent

Return type:

bool

PySide2.QtMultimedia.QMediaPlaylist.clear()
Return type:

bool

Remove all the items from the playlist.

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

PySide2.QtMultimedia.QMediaPlaylist.currentIndex()
Return type:

int

This property holds Current position..

PySide2.QtMultimedia.QMediaPlaylist.currentIndexChanged(index)
Parameters:

index – int

PySide2.QtMultimedia.QMediaPlaylist.currentMedia()
Return type:

PySide2.QtMultimedia.QMediaContent

This property holds Current media content..

PySide2.QtMultimedia.QMediaPlaylist.currentMediaChanged(arg__1)
Parameters:

arg__1PySide2.QtMultimedia.QMediaContent

PySide2.QtMultimedia.QMediaPlaylist.error()
Return type:

Error

Returns the last error condition.

PySide2.QtMultimedia.QMediaPlaylist.errorString()
Return type:

str

Returns the string describing the last error condition.

PySide2.QtMultimedia.QMediaPlaylist.insertMedia(index, items)
Parameters:
  • index – int

  • items

Return type:

bool

PySide2.QtMultimedia.QMediaPlaylist.insertMedia(index, content)
Parameters:
Return type:

bool

PySide2.QtMultimedia.QMediaPlaylist.isEmpty()
Return type:

bool

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

See also

mediaCount()

PySide2.QtMultimedia.QMediaPlaylist.isReadOnly()
Return type:

bool

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

See also

mediaCount()

PySide2.QtMultimedia.QMediaPlaylist.load(location[, format=None])
Parameters:
PySide2.QtMultimedia.QMediaPlaylist.load(request[, format=None])
Parameters:
PySide2.QtMultimedia.QMediaPlaylist.load(device[, format=None])
Parameters:

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.

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

PySide2.QtMultimedia.QMediaPlaylist.loadFailed()
PySide2.QtMultimedia.QMediaPlaylist.loaded()
PySide2.QtMultimedia.QMediaPlaylist.media(index)
Parameters:

index – int

Return type:

PySide2.QtMultimedia.QMediaContent

Returns the media content at index in the playlist.

PySide2.QtMultimedia.QMediaPlaylist.mediaAboutToBeInserted(start, end)
Parameters:
  • start – int

  • end – int

PySide2.QtMultimedia.QMediaPlaylist.mediaAboutToBeRemoved(start, end)
Parameters:
  • start – int

  • end – int

PySide2.QtMultimedia.QMediaPlaylist.mediaChanged(start, end)
Parameters:
  • start – int

  • end – int

PySide2.QtMultimedia.QMediaPlaylist.mediaCount()
Return type:

int

Returns the number of items in the playlist.

See also

isEmpty()

PySide2.QtMultimedia.QMediaPlaylist.mediaInserted(start, end)
Parameters:
  • start – int

  • end – int

PySide2.QtMultimedia.QMediaPlaylist.mediaRemoved(start, end)
Parameters:
  • start – int

  • end – int

PySide2.QtMultimedia.QMediaPlaylist.moveMedia(from, to)
Parameters:
  • from – int

  • to – int

Return type:

bool

Move the item from position from to position to .

Returns true if the operation is successful, otherwise false.

PySide2.QtMultimedia.QMediaPlaylist.next()

Advance to the next media content in playlist.

PySide2.QtMultimedia.QMediaPlaylist.nextIndex([steps=1])
Parameters:

steps – int

Return type:

int

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.

PySide2.QtMultimedia.QMediaPlaylist.playbackMode()
Return type:

PlaybackMode

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

See also

PlaybackMode

PySide2.QtMultimedia.QMediaPlaylist.playbackModeChanged(mode)
Parameters:

modePlaybackMode

PySide2.QtMultimedia.QMediaPlaylist.previous()

Return to the previous media content in playlist.

PySide2.QtMultimedia.QMediaPlaylist.previousIndex([steps=1])
Parameters:

steps – int

Return type:

int

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

PySide2.QtMultimedia.QMediaPlaylist.removeMedia(pos)
Parameters:

pos – int

Return type:

bool

Remove the item from the playlist at position pos .

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

PySide2.QtMultimedia.QMediaPlaylist.removeMedia(start, end)
Parameters:
  • start – int

  • end – int

Return type:

bool

Remove items in the playlist from start to end inclusive.

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

PySide2.QtMultimedia.QMediaPlaylist.save(device, format)
Parameters:
Return type:

bool

Save playlist to QIODevice device using format format .

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

PySide2.QtMultimedia.QMediaPlaylist.save(location[, format=None])
Parameters:
Return type:

bool

PySide2.QtMultimedia.QMediaPlaylist.setCurrentIndex(index)
Parameters:

index – int

This property holds Current position..

PySide2.QtMultimedia.QMediaPlaylist.setPlaybackMode(mode)
Parameters:

modePlaybackMode

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

See also

PlaybackMode

PySide2.QtMultimedia.QMediaPlaylist.shuffle()

Shuffle items in the playlist.