This repository has been archived on 2024-12-03. You can view files and clone it, but cannot push or open issues or pull requests.
PyBitmessage-2024-12-03/src/plugins/sound_gstreamer.py
2020-01-07 15:27:16 +05:30

18 lines
438 B
Python

# -*- coding: utf-8 -*-
"""
Sound notification plugin using gstreamer
"""
import gi
gi.require_version('Gst', '1.0')
from gi.repository import Gst # noqa: E402
Gst.init(None)
_player = Gst.ElementFactory.make("playbin", "player")
def connect_plugin(sound_file):
"""Entry point for sound file"""
_player.set_state(Gst.State.NULL)
_player.set_property("uri", "file://" + sound_file)
_player.set_state(Gst.State.PLAYING)