recording

Summit recording library.

Classes

Name Summary
RecordingResult

Represents a playable recording

Functions

Name Summary
recording

Constructs a RecordingResult object.

Classes : recording

RecordingResult

Represents a playable recording

This object represents a playable recording which has be instantiated from its ID. This object can be used as an argument to channel.play or channel.gather and will be treated like any other asset or speech object. It cannot be instantiated directly, but is returned by using this library.

You can find more usage examples in the documentation for HTTP and Email

Fields
Name Type Summary
id

uuid

The ID for this recording

duration

float

The duration (in seconds) of this recording

read

function

Returns a binary representation of this recording; if you want to do something like use this recording as data in an HTTP request, you should use the base64() function instead

base64

function

Returns a base64-encoded string representation of the recording

mp3

recording.RecordingResult

A reference to a copy of this object where the read() and base64() methods will return mp3 data

wav

recording.RecordingResult

A reference to a copy of this object where the read() and base64() methods will return wav data. Note: returning wav is the default behavior of RecordingResult.

Functions : recording

recording(recording_id)

Constructs a RecordingResult object. This is useful for playing back existing recordings by ID.

Parameters
Name Type Default Summary

recording_id

string

String which refers to a recording ID

Returns
Type Summary

RecordingResult or nil

A recording for the given ID if it exists, or nil if no recording can be found.

Usage
local recording = require("summit.recording")
...
some_recording = channel.record()
r_id = some_recording.id          -- some_recording is of type RecordingResult
my_recording = recording(r_id)    -- you should check that my_recording ~= nil before sending to channel.play in real apps
channel.play(my_recording, {recordingType = "voice"})