Class: Video

Inherits:
CommitPhoto show all
Defined in:
lib/commitphotos/video.rb

Constant Summary

Constants inherited from CommitPhoto

CommitPhoto::VERSION

Instance Method Summary collapse

Methods inherited from CommitPhoto

image, #setup_hook, video

Constructor Details

#initializeVideo

Returns a new instance of Video.



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/commitphotos/video.rb', line 2

def initialize
  path = "/tmp/#{Time.now.to_i.to_s}.mov"

  `#{dir}/videosnap -t 2 --no-audio #{path}`

  begin
    post(File.open path)
  rescue => e
    abort "Unable to capture video: #{e.message}"
  ensure
    FileUtils.rm(path)
  end
end