class MultimediaParadise::GUI::Libui::VideoPlayer

Public Class Methods

new() click to toggle source
#

initialize

#
# File lib/multimedia_paradise/gui/libui/video_player/video_player.rb, line 26
def initialize
  create_skeleton
  @main_window = ui_main_window(
    'Video Player', 600, 250, 0
  )
  outer_vbox = ui_vbox
  outer_vbox.is_padded

  # ======================================================================= #
  # Add the buttons next:
  # ======================================================================= #
  button_play_the_video = button('Play a random video 📺')
  button_play_the_video.on_clicked {
    do_play_a_random_video
  }
  button = ui_quit_button # Use a quit button.
  vbox = padded_vbox
  vbox.add(button_play_the_video, 0)
  vbox.add(button,                0)
  outer_vbox << vbox

  @main_window.child = outer_vbox
  @main_window.intelligent_exit
end

Public Instance Methods

create_skeleton() click to toggle source
#

create_skeleton

#
# File lib/multimedia_paradise/gui/libui/video_player/video_player.rb, line 73
def create_skeleton
  @entry_URL_to_use_for_the_youtube_video = ui_entry
end
do_play_a_random_video() click to toggle source
#

do_play_a_random_video

#
# File lib/multimedia_paradise/gui/libui/video_player/video_player.rb, line 54
def do_play_a_random_video
  # ======================================================================= #
  # The -wid option tells mpv to connect to the window represented by the
  # ID $WINDOW_XID.
  #
  # Note that a simpler alternative to obtaining the xid value would be:
  #
  #   drawing_area.window.xid
  #
  # For now I retain the approach I chosen specified at the end of this
  # file, though.
  # ======================================================================= #
  _ = 'mpv '+::MultimediaParadise.return_random_video_that_exists.to_s
  esystem _
end