當前位置: 首頁>>代碼示例>>Python>>正文


Python QtMultimedia.QMediaPlayer方法代碼示例

本文整理匯總了Python中PyQt5.QtMultimedia.QMediaPlayer方法的典型用法代碼示例。如果您正苦於以下問題:Python QtMultimedia.QMediaPlayer方法的具體用法?Python QtMultimedia.QMediaPlayer怎麽用?Python QtMultimedia.QMediaPlayer使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt5.QtMultimedia的用法示例。


在下文中一共展示了QtMultimedia.QMediaPlayer方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: play_pronunciation

# 需要導入模塊: from PyQt5 import QtMultimedia [as 別名]
# 或者: from PyQt5.QtMultimedia import QMediaPlayer [as 別名]
def play_pronunciation(self):
        if not self.pronunciation_mp3 or not multimedia_available:
            return

        media_content = QtMultimedia.QMediaContent(
            QtCore.QUrl(self.pronunciation_mp3))

        player = QtMultimedia.QMediaPlayer(self)
        player.setMedia(media_content)
        player.play() 
開發者ID:BasioMeusPuga,項目名稱:Lector,代碼行數:12,代碼來源:definitionsdialog.py

示例2: setup_soundtrack_player

# 需要導入模塊: from PyQt5 import QtMultimedia [as 別名]
# 或者: from PyQt5.QtMultimedia import QMediaPlayer [as 別名]
def setup_soundtrack_player():
    """
    Initializes the singleton soundtrack player.
    """
    global soundtrack_player
    global soundtrack_playlist

    if soundtrack_player:
        raise RuntimeError('Should setup the player only once')
    if not soundtrack_playlist:
        raise RuntimeError('Need to load the playlist before')

    soundtrack_player = QtMultimedia.QMediaPlayer()
    soundtrack_player.setPlaylist(soundtrack_playlist) 
開發者ID:Trilarion,項目名稱:imperialism-remake,代碼行數:16,代碼來源:audio.py

示例3: __init__

# 需要導入模塊: from PyQt5 import QtMultimedia [as 別名]
# 或者: from PyQt5.QtMultimedia import QMediaPlayer [as 別名]
def __init__(self):
        super(VideoPlayer, self).__init__()

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

    # プレイリストに動畫を追加 
開發者ID:tody411,項目名稱:PyIntroduction,代碼行數:10,代碼來源:media_player.py

示例4: on_state_changed

# 需要導入模塊: from PyQt5 import QtMultimedia [as 別名]
# 或者: from PyQt5.QtMultimedia import QMediaPlayer [as 別名]
def on_state_changed(self, state):
        if state == qtmm.QMediaPlayer.PlayingState:
            self.setStyleSheet(self.stop_stylesheet)
            self.setText('Stop')
        else:
            self.setStyleSheet(self.play_stylesheet)
            self.setText('Play') 
開發者ID:PacktPublishing,項目名稱:Mastering-GUI-Programming-with-Python,代碼行數:9,代碼來源:soundboard.py

示例5: on_playbutton

# 需要導入模塊: from PyQt5 import QtMultimedia [as 別名]
# 或者: from PyQt5.QtMultimedia import QMediaPlayer [as 別名]
def on_playbutton(self):
        if self.player.state() == qtmm.QMediaPlayer.PlayingState:
            self.player.stop()
        else:
            self.player.play() 
開發者ID:PacktPublishing,項目名稱:Mastering-GUI-Programming-with-Python,代碼行數:7,代碼來源:soundboard.py

示例6: __init__

# 需要導入模塊: from PyQt5 import QtMultimedia [as 別名]
# 或者: from PyQt5.QtMultimedia import QMediaPlayer [as 別名]
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() 
開發者ID:python-discord,項目名稱:code-jam-5,代碼行數:13,代碼來源:music_player.py


注:本文中的PyQt5.QtMultimedia.QMediaPlayer方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。