Trouble getting gtksink to work in python

I recently had the trouble of wanting to play a video with 2 different audio streams on two different audio outputs. I managed to get this simple player “working” in python via gstreamer and gtk.

import sys
import gi
gi.require_version('Gtk', '3.0')
gi.require_version('Gst', '1.0')
gi.require_version('GstVideo', '1.0')

from gi.repository import Gtk, Gst, Gdk
Gst.init(None)
Gst.init_check(None)


class GstWidget(Gtk.Box):
    def __init__(self, file):
        super().__init__()
        self.connect('realize', self._on_realize)

        self.pipeline = Gst.Pipeline()
        self.pipeline = Gst.parse_launch(f"""
            filesrc location={file} ! decodebin name=decoded \
            decoded.src_0 ! queue ! videoconvert ! gtksink name=\"videosink0\" \
            decoded.src_1 ! queue ! audioconvert ! pulsesink \
            decoded.src_2 ! queue ! audioconvert ! pulsesink \
        """)


    def _on_realize(self, widget):
        
        gtksink = self.pipeline.get_by_name("videosink0")

        self.pack_start(gtksink.props.widget, True, True, 0)
        gtksink.props.widget.show()
        self.pipeline.set_state(Gst.State.PLAYING)

        self.connect('key-press-event', self._on_key_press)


    def _on_key_press(self, widget, event):
        keyval = event.keyval
        if keyval == Gdk.KEY_space:
            if self.pipeline.get_state(0)[1] == Gst.State.PLAYING:
                self.pipeline.set_state(Gst.State.PAUSED)
            else:
                self.pipeline.set_state(Gst.State.PLAYING)
        return True


if len(sys.argv) < 2:
    print(f"Usage: {sys.argv[0]} <file>")
    exit(1)

window = Gtk.ApplicationWindow()

header_bar = Gtk.HeaderBar()
header_bar.set_show_close_button(True)
window.set_titlebar(header_bar)

widget = GstWidget(sys.argv[1])
widget.set_size_request(480, 270)

window.add(widget)

window.show_all()

def on_destroy(win):
    try:
        Gtk.main_quit()
    except KeyboardInterrupt:
        pass

window.connect('destroy', on_destroy)

Gtk.main()

The problems started after adding the play/pause functionality: Pausing and resuming works once or twice after starting the application. Then after the third pause or so the video gets stuck and does not play again. Audio still works.
If I set the “sync” property on the gtksink to false, everything works, though obviously the video plays way too fast. But this indicates that it is somehow related to the gtksink.

Any help would greatly be appreciated as this is my first using gstreamer.
Thanks!