Class: Video

Inherits:
Object
  • Object
show all
Defined in:
lib/flick/video.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Video

Returns a new instance of Video.



5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/flick/video.rb', line 5

def initialize options
  Flick::Checker.action options[:action]
  Flick::Checker.platform options[:platform]
  Flick::Checker.format options[:format]
  self.action = options[:action]
  self.platform = options[:platform]
  case self.platform
  when "ios"
    self.driver = Flick::Ios.new options
  when "android"
    self.driver = Flick::Android.new options
  end
  self.image_count = options[:count]
  self.seconds = options[:seconds].to_f
  self.rate = options[:rate].to_f
  self.extended = options[:extend].to_b
  self.udid = self.driver.udid
  self.format = options[:format]
end

Instance Attribute Details

#actionObject

Returns the value of attribute action.



3
4
5
# File 'lib/flick/video.rb', line 3

def action
  @action
end

#driverObject

Returns the value of attribute driver.



3
4
5
# File 'lib/flick/video.rb', line 3

def driver
  @driver
end

#extendedObject

Returns the value of attribute extended.



3
4
5
# File 'lib/flick/video.rb', line 3

def extended
  @extended
end

#formatObject

Returns the value of attribute format.



3
4
5
# File 'lib/flick/video.rb', line 3

def format
  @format
end

#image_countObject

Returns the value of attribute image_count.



3
4
5
# File 'lib/flick/video.rb', line 3

def image_count
  @image_count
end

#platformObject

Returns the value of attribute platform.



3
4
5
# File 'lib/flick/video.rb', line 3

def platform
  @platform
end

#rateObject

Returns the value of attribute rate.



3
4
5
# File 'lib/flick/video.rb', line 3

def rate
  @rate
end

#secondsObject

Returns the value of attribute seconds.



3
4
5
# File 'lib/flick/video.rb', line 3

def seconds
  @seconds
end

#udidObject

Returns the value of attribute udid.



3
4
5
# File 'lib/flick/video.rb', line 3

def udid
  @udid
end

Instance Method Details

#androidObject



25
26
27
# File 'lib/flick/video.rb', line 25

def android
  platform == "android"
end

#iosObject



29
30
31
# File 'lib/flick/video.rb', line 29

def ios
  platform == "ios"
end

#runObject



33
34
35
# File 'lib/flick/video.rb', line 33

def run
  self.send(action)
end

#startObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/flick/video.rb', line 37

def start
  driver.clear_files
  puts "\nStarting Recoder!!!"
  if driver.recordable?
    if extended
      puts "In extended mode."
      Flick::Checker.system_dependency "mp4box"
      loop_record
    else
      start_record
    end
  else
    Flick::Checker.system_dependency "ffmpeg"
    start_screenshot_record
  end
end

#stopObject



54
55
56
57
58
59
60
61
62
63
# File 'lib/flick/video.rb', line 54

def stop
  puts "\nStopping Recorder!!!"
  if driver.recordable?
    stop_record
  else
    stop_screenshot_recording
  end
  sleep 1
  driver.clear_files
end