module MultimediaParadise::GUI::Gtk::VideoPlayerModule

Constants

HEIGHT
#

HEIGHT

#
NAMESPACE
#

NAMESPACE

#
TITLE
#

TITLE

#
WIDTH
#

WIDTH

#

Public Class Methods

new( commandline_arguments = ARGV, run_already = true ) click to toggle source
#

initialize

#
Calls superclass method
# File lib/multimedia_paradise/gui/shared_code/video_player/video_player_module.rb, line 49
def initialize(
    commandline_arguments = ARGV,
    run_already           = true
  )
  super(:vertical)
  reset
  _ = commandline_arguments
  # ======================================================================= #
  # === Handle Hashes first
  # ======================================================================= #
  if _.is_a? Hash
    if _.has_key? :xid_value
      @xid_value = _.delete(:xid_value)
    elsif _.has_key? :xid
      @xid_value = _.delete(:xid)
    end
  end
  run if run_already
end
run( i = ARGV ) click to toggle source
#

MultimediaParadise::GUI::Gtk::VideoPlayerModule.run

#
# File lib/multimedia_paradise/gui/shared_code/video_player/video_player_module.rb, line 172
def self.run(
    i = ARGV
  )
  require 'gtk_paradise/run'
  r = ::Gtk.run
  r.realize # At this point the widget will also receive an X11 XID value.
  xid_value = r.window.xid.to_s
  _ = ::MultimediaParadise::GUI::Gtk::VideoPlayer.new({ xid: xid_value })
  r << _
  r.automatic
  r.top_left_then_run
end

Public Instance Methods

border_size?() click to toggle source
#

border_size?

#
# File lib/multimedia_paradise/gui/shared_code/video_player/video_player_module.rb, line 109
def border_size?
  2
end
connect_skeleton() click to toggle source
#

connect_skeleton (connect tag)

#
# File lib/multimedia_paradise/gui/shared_code/video_player/video_player_module.rb, line 122
def connect_skeleton
  abort_on_exception
end
create_skeleton() click to toggle source
#

create_skeleton (create tag)

#
# File lib/multimedia_paradise/gui/shared_code/video_player/video_player_module.rb, line 116
def create_skeleton
end
do_play_a_random_video() click to toggle source
#

do_play_a_random_video

#
# File lib/multimedia_paradise/gui/shared_code/video_player/video_player_module.rb, line 129
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 --wid='+@xid_value.to_s+
      ' --start=280 '+
      return_random_video
  esystem _
end
padding?() click to toggle source
#

padding?

#
# File lib/multimedia_paradise/gui/shared_code/video_player/video_player_module.rb, line 102
def padding?
  0
end
reset() click to toggle source
#

reset (reset tag)

#
# File lib/multimedia_paradise/gui/shared_code/video_player/video_player_module.rb, line 72
def reset
  reset_the_internal_variables
  # ======================================================================= #
  # === @configuration
  # ======================================================================= #
  @configuration = [true, __dir__, NAMESPACE]
  # ======================================================================= #
  # === @title
  # ======================================================================= #
  @title  = TITLE
  # ======================================================================= #
  # === @width
  # ======================================================================= #
  set_width(WIDTH)
  # ======================================================================= #
  # === @height
  # ======================================================================= #
  set_height(HEIGHT)
  # ======================================================================= #
  # === @xid_value
  # ======================================================================= #
  @xid_value = nil
  set_use_this_font(:dejavu_condensed_22)
  append_project_css_file
  infer_the_size_automatically
end
run() click to toggle source
#

run (run tag)

#
# File lib/multimedia_paradise/gui/shared_code/video_player/video_player_module.rb, line 150
def run
  create_skeleton_then_connect_skeleton
  drawing_area = gtk_drawing_area
  drawing_area.set_size_request(640, 180)
  drawing_area.modify_background(:normal, :black)
  drawing_area.bblack2
  button = button('Play a <b>random</b> video')
  button.do_markify
  button.bblack2
  button.on_clicked {
    do_play_a_random_video
  }
  add_horizontal_spacer
  add(drawing_area)
  add_horizontal_spacer
  add(button)
  add_horizontal_spacer
end