Class: OpenTok::Render

Inherits:
Object
  • Object
show all
Defined in:
lib/opentok/render.rb

Overview

Represents an Experience Composer render of an OpenTok session. See / Experience Composer.

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



69
70
71
72
73
74
75
76
# File 'lib/opentok/render.rb', line 69

def method_missing(method, *args, &block)
  camelized_method = method.to_s.camelize(:lower)
  if @json.has_key? camelized_method and args.empty?
    @json[camelized_method]
  else
    super method, *args, &block
  end
end

Instance Attribute Details

#created_atint

The time the Experience Composer started, expressed in milliseconds since the Unix epoch.

Returns:

  • (int)

    the current value of created_at



42
43
44
# File 'lib/opentok/render.rb', line 42

def created_at
  @created_at
end

#idstring

The unique ID for the Experience Composer.

Returns:

  • (string)

    the current value of id



42
43
44
# File 'lib/opentok/render.rb', line 42

def id
  @id
end

#project_idstring

The API key associated with the render.

Returns:

  • (string)

    the current value of project_id



42
43
44
# File 'lib/opentok/render.rb', line 42

def project_id
  @project_id
end

#reasonstring

The reason field is only available when the status is either “stopped” or “failed”. If the status is stopped, the reason field will contain either

"Max Duration Exceeded" or "Stop Requested." If the status is failed, the reason will contain a more specific error message.

Returns:

  • (string)

    the current value of reason



42
43
44
# File 'lib/opentok/render.rb', line 42

def reason
  @reason
end

#resolutionstring

The resolution of the Experience Composer (either “640x480”, “480x640”, “1280x720”, “720x1280”, “1920x1080”, or “1080x1920”).

Returns:

  • (string)

    the current value of resolution



42
43
44
# File 'lib/opentok/render.rb', line 42

def resolution
  @resolution
end

#session_idstring

The session ID of the OpenTok session associated with this render.

Returns:

  • (string)

    the current value of session_id



42
43
44
# File 'lib/opentok/render.rb', line 42

def session_id
  @session_id
end

#statusstring

The status of the Experience Composer. Poll frequently to check status updates. This property set to one of the following:

- "starting" — The Vonage Video API platform is in the process of connecting to the remote application at the URL provided. This is the initial state.
- "started" — The Vonage Video API platform has successfully connected to the remote application server, and is publishing the web view to an OpenTok stream.
- "stopped" — The Experience Composer has stopped.
- "failed" — An error occurred and the Experience Composer could not proceed. It may occur at startup if the OpenTok server cannot connect to the remote 
              application server or republish the stream. It may also occur at any point during the process due to an error in the Vonage Video API platform.

Returns:

  • (string)

    the current value of status



42
43
44
# File 'lib/opentok/render.rb', line 42

def status
  @status
end

#streamIdstring

The ID of the composed stream being published. The streamId is not available when the status is “starting” and may not be available when the status is “failed”.

Returns:

  • (string)

    the current value of streamId



42
43
44
# File 'lib/opentok/render.rb', line 42

def streamId
  @streamId
end

#updated_atint

The UNIX timestamp when the Experience Composer status was last updated.

Returns:

  • (int)

    the current value of updated_at



42
43
44
# File 'lib/opentok/render.rb', line 42

def updated_at
  @updated_at
end

#urlstring

A publicly reachable URL controlled by the customer and capable of generating the content to be rendered without user intervention.

Returns:

  • (string)

    the current value of url



42
43
44
# File 'lib/opentok/render.rb', line 42

def url
  @url
end

Instance Method Details

#infoObject

Gets info about the OpenTok Experience Composer render.



63
64
65
66
# File 'lib/opentok/render.rb', line 63

def info
# TODO: validate returned json fits schema
  @json = @interface.find @json['id']
end

#stopObject

Stops the OpenTok Experience Composer render.



57
58
59
60
# File 'lib/opentok/render.rb', line 57

def stop
  # TODO: validate returned json fits schema
  @json = @interface.stop @json['id']
end

#to_jsonObject

A JSON-encoded string representation of the Experience Composer render.



52
53
54
# File 'lib/opentok/render.rb', line 52

def to_json
  @json.to_json
end