Class: OpenTok::Captions

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

Overview

A class for working with OpenTok captions.

Instance Method Summary collapse

Instance Method Details

#start(session_id, token, options = {}) ⇒ Object

Starts live captions for the specified OpenTok session. See the / OpenTok Live Captions developer guide.

Examples:

opts = { "language_code" => "en-GB",
         "max_duration" => 5000,
         "partial_captions" => false,
         "status_callback_url" => status_callback_url
       }
response = opentok.captions.start(session_id, token, opts)

Parameters:

  • session_id (String)

    The session ID corresponding to the session for which captions will start.

  • token (String)

    The token for the session ID with which the SIP user will use to connect.

  • options (Hash) (defaults to: {})

    A hash defining options for the captions. For example:

Options Hash (options):

  • :language_code (String)

    The BCP-47 code for a spoken language used on this call. The default value is “en-US”. The following language codes are supported:

    - "en-AU" (English, Australia)
    - "en-GB" (Englsh, UK)
    - "es-US" (English, US)
    - "zh-CN” (Chinese, Simplified)
    - "fr-FR" (French)
    - "fr-CA" (French, Canadian)
    - "de-DE" (German)
    - "hi-IN" (Hindi, Indian)
    - "it-IT" (Italian)
    - "ja-JP" (Japanese)
    - "ko-KR" (Korean)
    - "pt-BR" (Portuguese, Brazilian)
    - "th-TH" (Thai)
    
  • :max_duration (Integer)

    The maximum duration for the audio captioning, in seconds. The default value is 14,400 seconds (4 hours), the maximum duration allowed.

  • :partial_captions (Boolean)

    Whether to enable this to faster captioning at the cost of some degree of inaccuracies. The default value is ‘true`.

  • :status_callback_url (String)

    A publicly reachable URL controlled by the customer and capable of generating the content to be rendered without user intervention. The minimum length of the URL is 15 characters and the maximum length is 2048 characters. For more information, see Live Caption status updates.



46
47
48
# File 'lib/opentok/captions.rb', line 46

def start(session_id, token, options = {})
  @client.start_live_captions(session_id, token, options)
end

#stop(captions_id) ⇒ Object

Starts live captions for the specified OpenTok session. See the / OpenTok Live Captions developer guide.

Examples:

response = opentok.captions.stop(captions_id)

Parameters:

  • captions_id (String)

    The ID for the captions to be stopped (returned from the ‘start` request).



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

def stop(captions_id)
  @client.stop_live_captions(captions_id)
end