class MPV::Session

Represents a combined mpv “server” and “client” communicating over JSON IPC.

Attributes

client[R]

@return [MPV::Client] the client communicating with mpv

server[R]

@return [MPV::Server] the server object responsible for the mpv process

socket_path[R]

@return [String] the path of the socket being used for communication

Public Class Methods

new(path: File.join('/tmp', Utils.tmpsock), user_args: []) click to toggle source

@param path [String] the path of the socket to create

(defaults to a tmpname in `/tmp`)

@param user_args [Array<String>] additional arguments to use when

spawning mpv
# File lib/mpv/session.rb, line 24
def initialize(path: File.join('/tmp', Utils.tmpsock), user_args: [])
  @socket_path = path

  @server = Server.new(path: @socket_path, user_args: user_args)

  sleep 0.1 until File.exist?(@socket_path)

  @client = Client.new(@socket_path)
end