Go back to Gstreamer for now

main
Micke Nordin 3 years ago
parent 4fb7014543
commit 094b25f8cb
Signed by: micke
GPG Key ID: 014B273D614BE877

@ -176,6 +176,7 @@ class Cast(wx.Frame):
self.m_sizer.Layout() self.m_sizer.Layout()
def show_video_list(self, _,channel_index) -> None: def show_video_list(self, _,channel_index) -> None:
self.Show()
self.m_selected_channel = self.m_selected_provider.get_channel_by_index(channel_index) self.m_selected_channel = self.m_selected_provider.get_channel_by_index(channel_index)
self.m_sizer.Clear(delete_windows=True) self.m_sizer.Clear(delete_windows=True)
self.m_sizer = wx.BoxSizer(wx.VERTICAL) self.m_sizer = wx.BoxSizer(wx.VERTICAL)
@ -238,7 +239,6 @@ class Cast(wx.Frame):
collapsable_pane = wx.CollapsiblePane(self.m_panel, wx.ID_ANY, "Details:") collapsable_pane = wx.CollapsiblePane(self.m_panel, wx.ID_ANY, "Details:")
inner_sizer.Add(collapsable_pane, 0, wx.GROW | wx.ALL, 5) inner_sizer.Add(collapsable_pane, 0, wx.GROW | wx.ALL, 5)
pane_win = collapsable_pane.GetPane() pane_win = collapsable_pane.GetPane()
# now add a test label in the collapsible pane using a sizer to layout it:
description = wx.StaticText(pane_win, -1, item["description"]) description = wx.StaticText(pane_win, -1, item["description"])
description.Wrap(WIDTH - 2) description.Wrap(WIDTH - 2)
@ -272,78 +272,58 @@ class Cast(wx.Frame):
""" """
self.m_sizer.Clear(delete_windows=True) self.m_sizer.Clear(delete_windows=True)
self.m_sizer = wx.BoxSizer(wx.VERTICAL) self.m_sizer = wx.BoxSizer(wx.VERTICAL)
#inner_sizer = wx.GridBagSizer() inner_sizer = wx.BoxSizer(wx.HORIZONTAL)
window = wx.Window(self.m_panel, self.m_control = wx.media.MediaCtrl(
size=(WIDTH, int(HEIGHT / 2)), self.m_panel,
) size=(0,0),
self.m_sizer.Add(window) szBackend=wx.media.MEDIABACKEND_GSTREAMER,
player = mpv.MPV(ytdl=False,player_operation_mode='pseudo-gui', )
script_opts='osc-layout=box,osc-seekbarstyle=bar,osc-deadzonesize=0,osc-minmousemove=3', play_button = wx.Button(self.m_panel, -1, "Play")
input_default_bindings=True,
input_vo_keyboard=True, pause_button = wx.Button(self.m_panel, -1, "Pause")
osc=True)
#player = mpv.MPV(ytdl=True, input_default_bindings=True, input_vo_keyboard=True, osc=True, wid=str(window.GetId())) back_button = wx.Button(self.m_panel, -1, "Back")
back_button.Bind(
wx.EVT_BUTTON,
lambda event, cindex=channel_index: self.show_video_list(event, cindex),
)
self.m_control.Show()
self.m_sizer.Add(self.m_control)
inner_sizer.Add(play_button)
inner_sizer.Add(pause_button)
inner_sizer.Add(back_button)
if not self.m_chromecast_thr.is_alive(
) and not self.m_selected_chromecast:
chromecast_button = wx.Button(self.m_panel, -1, "Cast")
chromecast_button.Bind(
wx.EVT_BUTTON,
lambda event, muri=uri, cindex=channel_index: self.select_chromecast(event, muri, cindex),
)
inner_sizer.Add(chromecast_button)
self.m_sizer.Add(inner_sizer)
if self.m_selected_chromecast:
self.Bind(
wx.media.EVT_MEDIA_LOADED,
lambda event, muri=uri: self.cast(event, muri),
)
play_button.Bind(wx.EVT_BUTTON, self.play_cast)
pause_button.Bind(wx.EVT_BUTTON, self.pause_cast)
else:
self.Bind(wx.media.EVT_MEDIA_LOADED, self.play)
play_button.Bind(wx.EVT_BUTTON, self.play)
pause_button.Bind(wx.EVT_BUTTON, self.pause)
self.Bind(wx.media.EVT_MEDIA_FINISHED, lambda event: self.show_video_list(event,0))
self.Bind(wx.EVT_POWER_SUSPENDING, lambda event: wx.EVT_POWER_SUSPENDING.Veto(event))
self.SetSizeHints(minW=WIDTH, minH=-1, maxH=HEIGHT)
self.load_uri(uri)
self.m_panel.SetSizer(self.m_sizer) self.m_panel.SetSizer(self.m_sizer)
self.m_sizer.Fit(self) self.m_sizer.Fit(self)
self.m_sizer.Layout() self.m_sizer.Layout()
try: self.Hide()
player.play(uri)
player.wait_for_playback()
except mpv.ShutdownError:
player.terminate()
del player
self.show_video_list(None,0)
#self.m_control = wx.media.MediaCtrl(
# self.m_panel,
# size=(WIDTH, int(HEIGHT / 2)),
# style=wx.SIMPLE_BORDER,
# szBackend=wx.media.MEDIABACKEND_GSTREAMER,
#)
#play_button = wx.Button(self.m_panel, -1, "Play")
#pause_button = wx.Button(self.m_panel, -1, "Pause")
#back_button = wx.Button(self.m_panel, -1, "Back")
#back_button.Bind(
# wx.EVT_BUTTON,
# lambda event, cindex=channel_index: self.show_video_list(event, cindex),
#)
#inner_sizer.Add(self.m_control, (0, 0))
#inner_sizer.SetItemSpan(0, (0, 6))
#inner_sizer.Add(play_button, (1, 1))
#inner_sizer.Add(pause_button, (1, 2))
#inner_sizer.Add(back_button, (1, 3))
#if not self.m_chromecast_thr.is_alive(
#) and not self.m_selected_chromecast:
# chromecast_button = wx.Button(self.m_panel, -1, "Cast")
# chromecast_button.Bind(
# wx.EVT_BUTTON,
# lambda event, muri=uri, cindex=channel_index: self.select_chromecast(event, muri, cindex),
# )
# inner_sizer.Add(chromecast_button, (2, 2))
#self.m_sizer.Add(inner_sizer)
#if self.m_selected_chromecast:
# self.Bind(
# wx.media.EVT_MEDIA_LOADED,
# lambda event, muri=uri: self.cast(event, muri),
# )
# play_button.Bind(wx.EVT_BUTTON, self.play_cast)
# pause_button.Bind(wx.EVT_BUTTON, self.pause_cast)
#else:
# self.Bind(wx.media.EVT_MEDIA_LOADED, self.play)
# play_button.Bind(wx.EVT_BUTTON, self.play)
# pause_button.Bind(wx.EVT_BUTTON, self.pause)
#self.Bind(wx.media.EVT_MEDIA_FINISHED, lambda event: self.show_video_list(event,0))
#self.load_uri(uri)
#self.m_panel.SetupScrolling(rate_y=SCROLL_RATE, scrollToTop=True)
#self.m_panel.SetSizer(self.m_sizer)
#self.m_sizer.Fit(self)
#self.m_sizer.Layout()
#self.m_panel.ScrollChildIntoView(self.m_control)
def select_chromecast(self, _, uri, channel_index): def select_chromecast(self, _, uri, channel_index):
self.m_sizer.Clear(delete_windows=True) self.m_sizer.Clear(delete_windows=True)

Loading…
Cancel
Save