from gi.repository import Gst
Gst.init(None)
-from gi.repository import GObject
-GObject.threads_init()
+from gi.repository import GLib
class Player:
def __init__(self):
- self.loop = GObject.MainLoop()
- self.pipeline = Gst.ElementFactory.make("playbin", "player")
+ self.loop = GLib.MainLoop()
+ self.pipeline = Gst.ElementFactory.make("playbin3", "player")
files = ["sample_440hz.webm", "sample_880hz.webm"]
self.uris = [Gst.filename_to_uri(f) for f in files]
player.on_switch()
return True
- GObject.io_add_watch(sys.stdin, GObject.IO_IN, stdin_cb)
+ GLib.io_add_watch(sys.stdin, GLib.IO_IN, stdin_cb)
print("\nPress Enter to switch the source\n")
player.run()