Class: Vonage::Video::Captions

Inherits:
Namespace
  • Object
show all
Defined in:
lib/vonage/video/captions.rb

Instance Method Summary collapse

Instance Method Details

#start(session_id:, token:, **params) ⇒ Response

Start Live Captions for a Vonage Video stream

Examples:

response = client.video.captions.start(
  session_id: "12312312-3811-4726-b508-e41a0f96c68f",
  token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJp...",
  language_code: 'en-US',
  max_duration: 300,
  partial_captions: false,
  status_callback_url: 'https://example.com/captions/status'
)

Parameters:

  • :token (required, String)

    A valid Vonage Video token with role set to 'moderator'

  • :max_duration (optional, Integer)

    The maximum duration for the audio captioning, in seconds.

    • The default value is 14,400 seconds (4 hours), the maximum duration allowed.
    • The minimum value for maxDuration is 300 (300 seconds, or 5 minutes).
  • :partial_captions (optional, Boolean)

    Whether to enable this to faster captioning (true, the default) at the cost of some degree of inaccuracies.

  • :status_callback_url (optional, String)

    The URL to send the status of the captions to.

Returns:

See Also:

  • Add document link here


45
46
47
48
49
50
# File 'lib/vonage/video/captions.rb', line 45

def start(session_id:, token:, **params)
  request(
    '/v2/project/' + @config.application_id + '/captions',
    params: camelcase(params.merge({sessionId: session_id, token: token})),
    type: Post)
end

#stop(captions_id:) ⇒ Response

Stop live captions for a session

Examples:

response = client.video.captions.stop(captions_id: "7c0580fc-6274-4de5-a66f-d0648e8d3ac3")

Returns:

See Also:

  • Add document link here


63
64
65
# File 'lib/vonage/video/captions.rb', line 63

def stop(captions_id:)
  request('/v2/project/' + @config.application_id + '/captions/' + captions_id + '/stop', type: Post)
end