Class: Animoto::Assets::Footage

Inherits:
Base
  • Object
show all
Defined in:
lib/animoto/assets/footage.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#source

Instance Method Summary collapse

Constructor Details

#initialize(source, options = {}) ⇒ Assets::Footage

Creates a new Footage object.

Parameters:

  • source (String)

    the source URL of this footage

  • options (Hash{Symbol=>Object}) (defaults to: {})

Options Hash (options):

  • :audio_mix (Boolean)

    whether or not to mix the audio from this footage with the soundtrack of the video

  • :start_time (Float)

    the offset in seconds from the beginning of where to start playing this footage

  • :duration (Float)

    the length in seconds to play this footage

  • :rotation (Integer)

    the number of clockwise 90-degree rotations to apply to this footage

  • :cover (Boolean)

    whether or not to generate the cover of this video from this footage



42
43
44
45
46
47
48
49
# File 'lib/animoto/assets/footage.rb', line 42

def initialize source, options = {}
  super
  @audio_mix  = options[:audio_mix]
  @start_time = options[:start_time]
  @duration   = options[:duration]
  @rotation   = options[:rotation]
  @cover      = options[:cover]
end

Instance Attribute Details

#audio_mixBoolean

Whether or not to mix the audio of this footage with the video’s soundtrack.

Returns:

  • (Boolean)


6
7
8
# File 'lib/animoto/assets/footage.rb', line 6

def audio_mix
  @audio_mix
end

#cover=(value) ⇒ Boolean (writeonly)

Whether or not this footage is the cover of the video. If this piece of footage is the video’s cover, the cover image will be generated from a frame in this footage.

Returns:

  • (Boolean)


24
25
26
# File 'lib/animoto/assets/footage.rb', line 24

def cover=(value)
  @cover = value
end

#durationFloat

The duration in seconds of how long this footage should run in the video.

Returns:

  • (Float)


15
16
17
# File 'lib/animoto/assets/footage.rb', line 15

def duration
  @duration
end

#rotationInteger

The number of clockwise 90-degree rotations that should be applied to this video.

Returns:

  • (Integer)


19
20
21
# File 'lib/animoto/assets/footage.rb', line 19

def rotation
  @rotation
end

#start_timeFloat

The time in seconds of where to start extracting a clip from this footage to add to the video.

Returns:

  • (Float)


11
12
13
# File 'lib/animoto/assets/footage.rb', line 11

def start_time
  @start_time
end

Instance Method Details

#cover?Boolean

Returns whether or not this footage is marked as the cover.

Returns:

  • (Boolean)


28
29
30
# File 'lib/animoto/assets/footage.rb', line 28

def cover?
  @cover
end

#to_hashHash{String=>Object}

Returns a representation of this Footage as a Hash.

Returns:

  • (Hash{String=>Object})

    this asset as a Hash

See Also:



55
56
57
58
59
60
61
62
63
# File 'lib/animoto/assets/footage.rb', line 55

def to_hash
  hash = super
  hash['audio_mix'] = audio_mix if audio_mix
  hash['start_time'] = start_time if start_time
  hash['duration'] = duration if duration
  hash['rotation'] = rotation if rotation
  hash['cover'] = cover? unless @cover.nil?
  hash 
end