Python PyQt5.QtMultimedia.QMediaPlayer() Examples
The following are 6
code examples of PyQt5.QtMultimedia.QMediaPlayer().
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: definitionsdialog.py From Lector with GNU General Public License v3.0 | 5 votes |
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()
Example #2
Source File: audio.py From imperialism-remake with GNU General Public License v3.0 | 5 votes |
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)
Example #3
Source File: media_player.py From PyIntroduction with MIT License | 5 votes |
def __init__(self): super(VideoPlayer, self).__init__() self._player = QMediaPlayer() self._playlist = QMediaPlaylist() self._stopped = True # プレイリストに動画を追加
Example #4
Source File: soundboard.py From Mastering-GUI-Programming-with-Python with MIT License | 5 votes |
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')
Example #5
Source File: soundboard.py From Mastering-GUI-Programming-with-Python with MIT License | 5 votes |
def on_playbutton(self): if self.player.state() == qtmm.QMediaPlayer.PlayingState: self.player.stop() else: self.player.play()
Example #6
Source File: music_player.py From code-jam-5 with MIT License | 5 votes |
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()