Python PyQt5.QtMultimedia.QMediaPlaylist() Examples

The following are 5 code examples of PyQt5.QtMultimedia.QMediaPlaylist(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PyQt5.QtMultimedia , or try the search function .
Example #1
Source File: audio.py    From imperialism-remake with GNU General Public License v3.0 7 votes vote down vote up
def load_soundtrack_playlist():
    """
    Loads the play list of the soundtracks and replaces the file name with the full path.

    A playlist is a list where each entry is a list of two strings: file path, title
    """
    global soundtrack_playlist

    # create playlist
    soundtrack_playlist = QtMultimedia.QMediaPlaylist()
    soundtrack_playlist.setPlaybackMode(QtMultimedia.QMediaPlaylist.Loop)

    # read information file
    data = utils.read_as_yaml(constants.SOUNDTRACK_INFO_FILE)

    # add the soundtrack folder to each file name
    for entry in data:
        file = constants.extend(constants.SOUNDTRACK_FOLDER, entry[0])
        url = qt.local_url(file)
        media = QtMultimedia.QMediaContent(url)
        soundtrack_playlist.addMedia(media) 
Example #2
Source File: media_player.py    From PyIntroduction with MIT License 5 votes vote down vote up
def __init__(self):
        super(VideoPlayer, self).__init__()

        self._player = QMediaPlayer()
        self._playlist = QMediaPlaylist()
        self._stopped = True

    # プレイリストに動画を追加 
Example #3
Source File: soundboard.py    From Mastering-GUI-Programming-with-Python with MIT License 5 votes vote down vote up
def set_file(self, url):
        self.label.setText(url.fileName())
        if url.scheme() == '':
            url.setScheme('file')
        content = qtmm.QMediaContent(url)
        #self.player.setMedia(content)
        # Looping
        # must retain a reference to the playlist
        # hence self.playlist
        self.playlist = qtmm.QMediaPlaylist()
        self.playlist.addMedia(content)
        self.playlist.setCurrentIndex(1)
        self.player.setPlaylist(self.playlist)
        self.loop_cb.setChecked(False) 
Example #4
Source File: soundboard.py    From Mastering-GUI-Programming-with-Python with MIT License 5 votes vote down vote up
def on_loop_cb(self, state):
        if state == qtc.Qt.Checked:
            self.playlist.setPlaybackMode(
                qtmm.QMediaPlaylist.CurrentItemInLoop)
        else:
            self.playlist.setPlaybackMode(
                qtmm.QMediaPlaylist.CurrentItemOnce) 
Example #5
Source File: music_player.py    From code-jam-5 with MIT License 5 votes vote down vote up
def __init__(self):
        super().__init__()
        self.player = QtMultimedia.QMediaPlayer()
        self.playlist = QtMultimedia.QMediaPlaylist()
        self.player.setPlaylist(self.playlist)
        self.player.playlist().currentMediaChanged.connect(self.disable_advert_controls)
        self.advert_in_progress = False

        self.advert_counter = self.total_songs_between_adverts - 1

        self.init_ui()