Fix playback
This commit is contained in:
parent
12b6f33de3
commit
4af3ee2164
1 changed files with 11 additions and 4 deletions
|
@ -1,6 +1,7 @@
|
|||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
from typing import Any, cast
|
||||
|
||||
|
@ -53,11 +54,14 @@ class MainWindow(Gtk.ApplicationWindow):
|
|||
|
||||
# Setup GStreamer pipeline
|
||||
self.pipeline = Gst.Pipeline.new("video-player")
|
||||
playbin = Gst.ElementFactory.make("playbin", "playbin")
|
||||
video_sink = Gst.ElementFactory.make("gtk4paintablesink", "gtk4paintablesink")
|
||||
|
||||
if not playbin or not video_sink:
|
||||
raise RuntimeError("Required GStreamer elements could not be created")
|
||||
playbin = Gst.ElementFactory.make("playbin", "playbin")
|
||||
if not playbin:
|
||||
raise RuntimeError("Failed to create playbin element")
|
||||
|
||||
video_sink = Gst.ElementFactory.make("gtk4paintablesink", "gtk4paintablesink")
|
||||
if not video_sink:
|
||||
raise RuntimeError("Failed to create gtk4paintablesink element")
|
||||
|
||||
playbin.set_property("video-sink", video_sink)
|
||||
self.pipeline.add(playbin)
|
||||
|
@ -235,5 +239,8 @@ class App(Gtk.Application):
|
|||
|
||||
|
||||
def main():
|
||||
if len(sys.argv) >= 2:
|
||||
os.chdir(sys.argv[1])
|
||||
|
||||
app = App()
|
||||
app.run(None)
|
||||
|
|
Loading…
Reference in a new issue