musicmouse/espmusicmouse/host_driver/player.py

18 lines
390 B
Python

import vlc
class AudioPlayer:
def __init__(self):
self.instance = vlc.Instance()
self.mediaplayer = self.instance.media_player_new()
def set_file(self, filename):
media = self.instance.media_new(filename)
self.mediaplayer.set_media(media)
def play(self):
self.mediaplayer.play()
def pause(self):
self.mediaplayer.pause()