内容表

上一话题

QMediaPlayerControl

下一话题

QMediaRecorder

QMediaPlaylist

QMediaPlaylist class provides a list of media content to play. 更多

Inheritance diagram of PySide2.QtMultimedia.QMediaPlaylist

概要

函数

信号

详细描述

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.

另请参阅

QMediaContent

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.

常量

描述

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.

另请参阅

setCurrentIndex()

PySide2.QtMultimedia.QMediaPlaylist. currentIndexChanged ( index )
参数

index int

PySide2.QtMultimedia.QMediaPlaylist. currentMedia ( )
返回类型

QMediaContent

Returns the current media content.

PySide2.QtMultimedia.QMediaPlaylist. currentMediaChanged ( arg__1 )
参数

arg__1 QMediaContent

PySide2.QtMultimedia.QMediaPlaylist. error ( )
返回类型

Error

Returns the last error condition.

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 )
参数
返回类型

bool

PySide2.QtMultimedia.QMediaPlaylist. isEmpty ( )
返回类型

bool

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

另请参阅

mediaCount()

PySide2.QtMultimedia.QMediaPlaylist. isReadOnly ( )
返回类型

bool

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

另请参阅

mediaCount()

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

返回类型

QMediaContent

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.

另请参阅

isEmpty()

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 ( )
返回类型

PlaybackMode

另请参阅

setPlaybackMode()

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 .

另请参阅

currentIndex()

PySide2.QtMultimedia.QMediaPlaylist. setPlaybackMode ( mode )
参数

mode PlaybackMode

另请参阅

playbackMode()

PySide2.QtMultimedia.QMediaPlaylist. shuffle ( )

Shuffle items in the playlist.