Class: RtmpDump

Inherits:
Player show all
Defined in:
lib/player/rtmpdump.rb

Instance Method Summary collapse

Methods inherited from Player

#duration, #options, #to_s

Constructor Details

#initializeRtmpDump

Returns a new instance of RtmpDump.



6
7
8
9
# File 'lib/player/rtmpdump.rb', line 6

def initialize
  self['live'] = ''
  self['quiet'] = ''
end

Instance Method Details

#commandObject



12
13
14
# File 'lib/player/rtmpdump.rb', line 12

def command
  'rtmpdump'
end

#playObject



17
18
19
20
# File 'lib/player/rtmpdump.rb', line 17

def play
  # puts "play: #{to_s} | mplayer -"
  %x(#{to_s} | mplayer -)
end

#rec(file, sec, quiet = true) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/player/rtmpdump.rb', line 23

def rec(file, sec, quiet = true)
  self['stop'] = sec

  if quiet
    self['flv'] = %Q("#{file}")
    puts "rec: #{to_s}"
    %x(#{to_s})
  else
    puts "rec: #{to_s}"
    %x(#{to_s} | tee "#{file}" | mplayer -)
  end
end