Class: FFMPEG::ScreenRecorder
- Inherits:
-
Object
- Object
- FFMPEG::ScreenRecorder
- Defined in:
- lib/ffmpeg/screenrecorder.rb,
lib/ffmpeg/version.rb
Overview
Constant Summary collapse
- VERSION =
'1.0.0'.freeze
Instance Attribute Summary collapse
- #options ⇒ Object readonly
- #video ⇒ Object readonly
Instance Method Summary collapse
-
#discard ⇒ Object
(also: #delete)
Discards the recorded file.
-
#initialize(options = {}) ⇒ ScreenRecorder
constructor
A new instance of ScreenRecorder.
-
#start ⇒ Object
Starts the recording.
-
#stop ⇒ Object
Stops the recording.
Constructor Details
#initialize(options = {}) ⇒ ScreenRecorder
Returns a new instance of ScreenRecorder.
12 13 14 15 16 17 |
# File 'lib/ffmpeg/screenrecorder.rb', line 12 def initialize( = {}) = RecorderOptions.new() @video = nil @process = nil initialize_logger(.log_level) end |
Instance Attribute Details
#options ⇒ Object (readonly)
10 11 12 |
# File 'lib/ffmpeg/screenrecorder.rb', line 10 def end |
#video ⇒ Object (readonly)
10 11 12 |
# File 'lib/ffmpeg/screenrecorder.rb', line 10 def video @video end |
Instance Method Details
#discard ⇒ Object Also known as: delete
Discards the recorded file. Useful in automated testing when a test passes and the recorded file is no longer needed.
48 49 50 |
# File 'lib/ffmpeg/screenrecorder.rb', line 48 def discard FileUtils.rm .output end |
#start ⇒ Object
Starts the recording
22 23 24 25 26 27 28 29 30 |
# File 'lib/ffmpeg/screenrecorder.rb', line 22 def start @video = nil # New file start_time = Time.now @process = start_ffmpeg elapsed = Time.now - start_time FFMPEG.logger.debug "Process started in #{elapsed}s" FFMPEG.logger.info 'Recording...' @process end |
#stop ⇒ Object
Stops the recording
35 36 37 38 39 40 41 |
# File 'lib/ffmpeg/screenrecorder.rb', line 35 def stop FFMPEG.logger.debug 'Stopping ffmpeg.exe...' elapsed = kill_ffmpeg FFMPEG.logger.debug "Stopped ffmpeg.exe in #{elapsed}s" FFMPEG.logger.info 'Recording complete.' @video = Movie.new(.output) end |