当前位置: 首页>>代码示例>>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;未经允许,请勿转载。