Class: Animoto::Manifests::Rendering

Inherits:
Base
  • Object
show all
Defined in:
lib/animoto/manifests/rendering.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#http_callback_format, #http_callback_url, #partner_metadata

Instance Method Summary collapse

Methods inherited from Base

#associated_job_class, associated_job_class, infer_content_type

Methods included from Support::ContentType

included

Constructor Details

#initialize(*args) ⇒ Manifests::Rendering

Creates a new rendering manifest.

Parameters:

  • storyboard (Resources::Storyboard)

    the storyboard for this rendering

  • options (Hash{Symbol=>Object})


38
39
40
41
42
43
44
45
46
47
48
# File 'lib/animoto/manifests/rendering.rb', line 38

def initialize *args
   options = args.last.is_a?(Hash) ? args.pop : {}
   super(options)
   @storyboard = args.shift
   @resolution = options[:resolution]
   @framerate  = options[:framerate]
   @format     = options[:format]
   @streaming  = options[:streaming]
   # We may or may not ever support other streaming formats
   @streaming_format = "http_live_streaming"
end

Instance Attribute Details

#formatString

The format of the rendered video. Valid values are ‘h264’.

Returns:

  • (String)


16
17
18
# File 'lib/animoto/manifests/rendering.rb', line 16

def format
  @format
end

#framerateInteger

The framerate of the rendered video. Valid values are 12, 15, 24 or 30.

Returns:

  • (Integer)


12
13
14
# File 'lib/animoto/manifests/rendering.rb', line 12

def framerate
  @framerate
end

#resolutionString

The vertical resolution of the rendered video. Valid values are ‘180p’, ‘270p’, ‘360p’, ‘480p’, or ‘720p’.

Returns:

  • (String)


8
9
10
# File 'lib/animoto/manifests/rendering.rb', line 8

def resolution
  @resolution
end

#storyboardResources::Storyboard

The storyboard this rendering targets.



20
21
22
# File 'lib/animoto/manifests/rendering.rb', line 20

def storyboard
  @storyboard
end

#streaming=(value) ⇒ Boolean (writeonly)

If streaming is set to true, a “live” stream will be made available to watch while the video is rendering via HTTP Live Streaming. This stream URL will be exposed on the associated rendering job.

Returns:

  • (Boolean)


26
27
28
# File 'lib/animoto/manifests/rendering.rb', line 26

def streaming=(value)
  @streaming = value
end

Instance Method Details

#streaming?Boolean

Returns true if an HTTP Live Streaming URL will be created for this video while it’s rendering.

Returns:

  • (Boolean)


54
55
56
# File 'lib/animoto/manifests/rendering.rb', line 54

def streaming?
  @streaming
end

#to_hashHash{String=>Object}

Returns a representation of this manifest as a Hash.

Returns:

  • (Hash{String=>Object})

    this manifest as a Hash

Raises:

  • (ArgumentError)

    if a callback URL was specified but not the format



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/animoto/manifests/rendering.rb', line 62

def to_hash
  hash  = { 'rendering_job' => { 'rendering_manifest' => { 'rendering_parameters' => {} } } }
  job   = hash['rendering_job']
  add_callback_information job
   job
  manifest = job['rendering_manifest']
  manifest['storyboard_url'] = storyboard.url if storyboard
  params = manifest['rendering_parameters']
  params['resolution'] = resolution
  params['framerate'] = framerate
  params['format'] = format
  if streaming?
    params['streaming_parameters'] = {}
    params['streaming_parameters']['format'] = @streaming_format
  end
  hash
end