QMediaPlaylist¶
The
QMediaPlaylistclass provides a list of media content to play. More…

Synopsis¶
Functions¶
def
addMedia(content)def
addMedia(items)def
clear()def
currentIndex()def
currentMedia()def
error()def
errorString()def
insertMedia(index, content)def
insertMedia(index, items)def
isEmpty()def
isReadOnly()def
load(device[, format=None])def
load(location[, format=None])def
load(request[, format=None])def
media(index)def
mediaCount()def
moveMedia(from, to)def
nextIndex([steps=1])def
playbackMode()def
previousIndex([steps=1])def
removeMedia(pos)def
removeMedia(start, end)def
save(device, format)def
save(location[, format=None])def
setPlaybackMode(mode)
Slots¶
def
next()def
previous()def
setCurrentIndex(index)def
shuffle()
Signals¶
def
currentIndexChanged(index)def
currentMediaChanged(arg__1)def
loadFailed()def
loaded()def
mediaAboutToBeInserted(start, end)def
mediaAboutToBeRemoved(start, end)def
mediaChanged(start, end)def
mediaInserted(start, end)def
mediaRemoved(start, end)def
playbackModeChanged(mode)
Detailed Description¶
QMediaPlaylistis intended to be used with other media objects, likeQMediaPlayer.
QMediaPlaylistallows 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
-
class
QMediaPlaylist([parent=None])¶ - param parent
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
QMediaPlaylisterror 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
content –
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
Returns position of the current media content in the playlist.
See also
-
PySide2.QtMultimedia.QMediaPlaylist.currentIndexChanged(index)¶ - Parameters
index –
int
-
PySide2.QtMultimedia.QMediaPlaylist.currentMedia()¶ - Return type
Returns the current media content.
-
PySide2.QtMultimedia.QMediaPlaylist.currentMediaChanged(arg__1)¶ - Parameters
arg__1 –
QMediaContent
-
PySide2.QtMultimedia.QMediaPlaylist.errorString()¶ - Return type
unicode
Returns the string describing the last error condition.
-
PySide2.QtMultimedia.QMediaPlaylist.insertMedia(index, items)¶ - Parameters
index –
intitems –
- Return type
bool
-
PySide2.QtMultimedia.QMediaPlaylist.insertMedia(index, content) - Parameters
index –
intcontent –
QMediaContent
- Return type
bool
-
PySide2.QtMultimedia.QMediaPlaylist.isEmpty()¶ - Return type
bool
Returns true if the playlist contains no items, otherwise returns false.
See also
-
PySide2.QtMultimedia.QMediaPlaylist.isReadOnly()¶ - Return type
bool
Returns true if the playlist can be modified, otherwise returns false.
See also
-
PySide2.QtMultimedia.QMediaPlaylist.load(location[, format=None])¶ - Parameters
location –
QUrlformat – str
-
PySide2.QtMultimedia.QMediaPlaylist.load(request[, format=None]) - Parameters
request –
QNetworkRequestformat – str
-
PySide2.QtMultimedia.QMediaPlaylist.load(device[, format=None]) - Parameters
device –
QIODeviceformat – str
Load playlist from
QIODevicedevice. Ifformatis 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 emitsloadFailed().
-
PySide2.QtMultimedia.QMediaPlaylist.loadFailed()¶
-
PySide2.QtMultimedia.QMediaPlaylist.loaded()¶
-
PySide2.QtMultimedia.QMediaPlaylist.media(index)¶ - Parameters
index –
int- Return type
Returns the media content at
indexin the playlist.
-
PySide2.QtMultimedia.QMediaPlaylist.mediaAboutToBeInserted(start, end)¶ - Parameters
start –
intend –
int
-
PySide2.QtMultimedia.QMediaPlaylist.mediaAboutToBeRemoved(start, end)¶ - Parameters
start –
intend –
int
-
PySide2.QtMultimedia.QMediaPlaylist.mediaChanged(start, end)¶ - Parameters
start –
intend –
int
-
PySide2.QtMultimedia.QMediaPlaylist.mediaCount()¶ - Return type
int
Returns the number of items in the playlist.
See also
-
PySide2.QtMultimedia.QMediaPlaylist.mediaInserted(start, end)¶ - Parameters
start –
intend –
int
-
PySide2.QtMultimedia.QMediaPlaylist.mediaRemoved(start, end)¶ - Parameters
start –
intend –
int
-
PySide2.QtMultimedia.QMediaPlaylist.moveMedia(from, to)¶ - Parameters
from –
intto –
int
- Return type
bool
Move the item from position
fromto positionto.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()stepstimes.Returned value depends on the size of playlist, current position and playback mode.
See also
-
PySide2.QtMultimedia.QMediaPlaylist.playbackMode()¶ - Return type
See also
-
PySide2.QtMultimedia.QMediaPlaylist.playbackModeChanged(mode)¶ - Parameters
mode –
PlaybackMode
-
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()stepstimes.See also
-
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 –
intend –
int
- Return type
bool
Remove items in the playlist from
starttoendinclusive.Returns true if the operation is successful, otherwise return false.
-
PySide2.QtMultimedia.QMediaPlaylist.save(device, format)¶ - Parameters
device –
QIODeviceformat – str
- Return type
bool
Save playlist to
QIODevicedeviceusing formatformat.Returns true if playlist was saved successfully, otherwise returns false.
-
PySide2.QtMultimedia.QMediaPlaylist.save(location[, format=None]) - Parameters
location –
QUrlformat – str
- Return type
bool
-
PySide2.QtMultimedia.QMediaPlaylist.setCurrentIndex(index)¶ - Parameters
index –
int
Activate media content from playlist at position
playlistPosition.See also
-
PySide2.QtMultimedia.QMediaPlaylist.setPlaybackMode(mode)¶ - Parameters
mode –
PlaybackMode
See also
-
PySide2.QtMultimedia.QMediaPlaylist.shuffle()¶ Shuffle items in the playlist.
© 2018 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.