Class: VLC::Client

Inherits:
Object
  • Object
show all
Includes:
ConnectionManagement, MediaControls, PlaylistControls, VideoControls
Defined in:
lib/vlc-client.rb,
lib/vlc-client/client/media_controls.rb,
lib/vlc-client/client/video_controls.rb,
lib/vlc-client/client/playlist_controls.rb,
lib/vlc-client/client/connection_management.rb

Overview

The VLC client

Defined Under Namespace

Modules: ConnectionManagement, MediaControls, PlaylistControls, VideoControls

Constant Summary

Constants included from MediaControls

MediaControls::STATUS_MAPPING

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ConnectionManagement

#connect, #connected?, #disconnect, #disconnected?

Methods included from VideoControls

#fullscreen

Methods included from PlaylistControls

#add_to_playlist, #clear, #next, #playlist, #previous

Methods included from MediaControls

#length, #pause, #play, #playing?, #progress, #seek, #status, #stop, #stopped?, #time, #title, #volume, #volume=

Constructor Details

#initialize(host, port) ⇒ VLC::VLC #initialize(server, options) ⇒ VLC::VLC

Creates a client to manage VLC media player

Overloads:

  • #initialize(host, port) ⇒ VLC::VLC

    Examples:

    vlc = VLC::Client.new('10.10.0.10', 9000)

    Parameters:

    • host (String)

      The ip to connect to

    • port (Integer)

      the port

  • #initialize(server, options) ⇒ VLC::VLC

    Examples:

    vlc = VLC::Client.new(VLC::Server.new)
    vlc.server.started?
    #=> true
    vlc = VLC::Client.new(VLC::Server.new, auto_start: false)
    vlc.server.started?
    #=> false

    Parameters:

    • server (Server)

      a VLC server lifecycle manager

    • options (Hash)

    Options Hash (options):

    • :auto_start (Boolean)

      When false, the server lifecycle is not managed automatically and controll is passed to the developer

    • :conn_retries (Integer)

      Number of connection retries (each separated by a second) to make on auto-connect. Defaults to 5.

    • :daemonize (Boolean)

      When true and only when on server auto-start mode, the server will be detached and run as a daemon process. Defaults to false.

    • :read_timeout (Integer)

      Read timout value

Raises:


63
64
65
66
67
68
69
70
71
# File 'lib/vlc-client.rb', line 63

def initialize(*args)
  args = NullObject.Null?(args)

  options = args.extract_options!
  process_args(args)

  @connection = Connection.new(host, port, options[:read_timeout])
  bind_server(server, options) unless server.nil?
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection


25
26
27
# File 'lib/vlc-client.rb', line 25

def connection
  @connection
end

#hostObject

Returns the value of attribute host


26
27
28
# File 'lib/vlc-client.rb', line 26

def host
  @host
end

#portObject

Returns the value of attribute port


26
27
28
# File 'lib/vlc-client.rb', line 26

def port
  @port
end

#serverObject

Returns the value of attribute server


26
27
28
# File 'lib/vlc-client.rb', line 26

def server
  @server
end