QMediaPlaylistclass provides a list of media content to play. 更多 …
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)
def
next
()
def
上一
()
def
setCurrentIndex
(index)
def
shuffle
()
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)
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.
另请参阅
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.
|
常量 |
描述 |
|---|---|
|
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.
|
常量 |
描述 |
|---|---|
|
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
)
¶
items –
bool
PySide2.QtMultimedia.QMediaPlaylist.
addMedia
(
content
)
¶
content
–
QMediaContent
bool
PySide2.QtMultimedia.QMediaPlaylist.
clear
(
)
¶
bool
Remove all the items from the playlist.
Returns true if the operation is successful, otherwise return false.
PySide2.QtMultimedia.QMediaPlaylist.
currentIndex
(
)
¶
int
Returns position of the current media content in the playlist.
另请参阅
PySide2.QtMultimedia.QMediaPlaylist.
currentIndexChanged
(
index
)
¶
index
–
int
PySide2.QtMultimedia.QMediaPlaylist.
currentMedia
(
)
¶
Returns the current media content.
PySide2.QtMultimedia.QMediaPlaylist.
currentMediaChanged
(
arg__1
)
¶
arg__1
–
QMediaContent
PySide2.QtMultimedia.QMediaPlaylist.
errorString
(
)
¶
unicode
Returns the string describing the last error condition.
PySide2.QtMultimedia.QMediaPlaylist.
insertMedia
(
index
,
items
)
¶
index
–
int
items –
bool
PySide2.QtMultimedia.QMediaPlaylist.
insertMedia
(
index
,
content
)
¶
index
–
int
content
–
QMediaContent
bool
PySide2.QtMultimedia.QMediaPlaylist.
isEmpty
(
)
¶
bool
Returns true if the playlist contains no items, otherwise returns false.
另请参阅
PySide2.QtMultimedia.QMediaPlaylist.
isReadOnly
(
)
¶
bool
Returns true if the playlist can be modified, otherwise returns false.
另请参阅
PySide2.QtMultimedia.QMediaPlaylist.
load
(
location
[
,
format=None
]
)
¶
location
–
QUrl
format – str
PySide2.QtMultimedia.QMediaPlaylist.
load
(
request
[
,
format=None
]
)
¶
request
–
QNetworkRequest
format – str
PySide2.QtMultimedia.QMediaPlaylist.
load
(
device
[
,
format=None
]
)
¶
device
–
QIODevice
format – str
Load playlist from
QIODevice
device
。若
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
)
¶
index
–
int
Returns the media content at
index
in the playlist.
PySide2.QtMultimedia.QMediaPlaylist.
mediaAboutToBeInserted
(
start
,
end
)
¶
start
–
int
end
–
int
PySide2.QtMultimedia.QMediaPlaylist.
mediaAboutToBeRemoved
(
start
,
end
)
¶
start
–
int
end
–
int
PySide2.QtMultimedia.QMediaPlaylist.
mediaChanged
(
start
,
end
)
¶
start
–
int
end
–
int
PySide2.QtMultimedia.QMediaPlaylist.
mediaCount
(
)
¶
int
Returns the number of items in the playlist.
另请参阅
PySide2.QtMultimedia.QMediaPlaylist.
mediaInserted
(
start
,
end
)
¶
start
–
int
end
–
int
PySide2.QtMultimedia.QMediaPlaylist.
mediaRemoved
(
start
,
end
)
¶
start
–
int
end
–
int
PySide2.QtMultimedia.QMediaPlaylist.
moveMedia
(
from
,
to
)
¶
from
–
int
to
–
int
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
]
)
¶
steps
–
int
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
(
)
¶
另请参阅
PySide2.QtMultimedia.QMediaPlaylist.
playbackModeChanged
(
mode
)
¶
mode
–
PlaybackMode
PySide2.QtMultimedia.QMediaPlaylist.
上一
(
)
¶
Return to the previous media content in playlist.
PySide2.QtMultimedia.QMediaPlaylist.
previousIndex
(
[
steps=1
]
)
¶
steps
–
int
int
Returns the index of the item, which would be current after calling
previous()
steps
times.
PySide2.QtMultimedia.QMediaPlaylist.
removeMedia
(
pos
)
¶
pos
–
int
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
)
¶
start
–
int
end
–
int
bool
Remove items in the playlist from
start
to
end
包含在内。
Returns true if the operation is successful, otherwise return false.
PySide2.QtMultimedia.QMediaPlaylist.
save
(
device
,
format
)
¶
device
–
QIODevice
format – str
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
]
)
¶
location
–
QUrl
format – str
bool
PySide2.QtMultimedia.QMediaPlaylist.
setCurrentIndex
(
index
)
¶
index
–
int
Activate media content from playlist at position
playlistPosition
.
另请参阅
PySide2.QtMultimedia.QMediaPlaylist.
setPlaybackMode
(
mode
)
¶
mode
–
PlaybackMode
另请参阅
PySide2.QtMultimedia.QMediaPlaylist.
shuffle
(
)
¶
Shuffle items in the playlist.