NAME

Twilio::Rest::Video::V1::CompositionHook - The CompositionHook resource

SYNOPSIS

my $client = Twilio::Rest::Client->new($account_sid, $auth_token);

my $composition_hook = $client->video->v1->composition_hooks->create($friendly_name, \%options);
for my $composition_hook ($client->video->v1->composition_hooks->read({}, 20)) {
  ...
}
my $composition_hook = $client->video->v1->composition_hooks($sid)->fetch;
$client->video->v1->composition_hooks($sid)->update($friendly_name, \%options);
$client->video->v1->composition_hooks($sid)->delete;

DESCRIPTION

Recording composition hooks

This file holds CompositionHookList, CompositionHookPage, CompositionHookContext and CompositionHookInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.

CompositionHookList

Returned by $client->video->v1->composition_hooks. See also Twilio::ListResource.

create

my $composition_hook = $client->video->v1->composition_hooks->create($friendly_name, \%options);

Returns a CompositionHookInstance.

The required values are:

$friendly_name

A descriptive string that you create to describe the resource. It can be up to 100 characters long and it must be unique within the account.

The options are:

audio_sources

An array of track names from the same group room to merge into the compositions created by the composition hook. Can include zero or more track names. A composition triggered by the composition hook includes all audio sources specified in audio_sources except those specified in audio_sources_excluded. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, student* includes tracks named student as well as studentTeam. An array reference.

audio_sources_excluded

An array of track names to exclude. A composition triggered by the composition hook includes all audio sources specified in audio_sources except for those specified in audio_sources_excluded. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, student* excludes student as well as studentTeam. This parameter can also be empty. An array reference.

enabled

Whether the composition hook is active. When true, the composition hook will be triggered for every completed Group Room in the account. When false, the composition hook will never be triggered.

format

One of mp4 or webm.

resolution

A string that describes the columns (width) and rows (height) of the generated composed video in pixels. Defaults to 640x480. The string's format is {width}x{height} where: * 16 <= {width} <= 1280 * 16 <= {height} <= 1280 * {width} * {height} <= 921,600 Typical values are: * HD = 1280x720 * PAL = 1024x576 * VGA = 640x480 * CIF = 320x240 Note that the resolution imposes an aspect ratio to the resulting composition. When the original video tracks are constrained by the aspect ratio, they are scaled to fit. See Specifying Video Layouts for more info.

status_callback

The URL we should call using the status_callback_method to send status information to your application on every composition event. If not provided, status callback events will not be dispatched.

status_callback_method

The HTTP method we should use to call status_callback. Can be: POST or GET and the default is POST. One of GET or POST.

trim

Whether to clip the intervals where there is no active media in the Compositions triggered by the composition hook. The default is true. Compositions with trim enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See Specifying Video Layouts for more info.

video_layout

An object that describes the video layout of the composition hook in terms of regions. See Specifying Video Layouts for more info. A hash or array reference, or a string of JSON.

read

my @records = $client->video->v1->composition_hooks->read(\%options, $limit, $page_size);

List of all Recording CompositionHook resources. Returns the records as a list, fetching as many pages as it needs.

The options are:

date_created_after

Read only CompositionHook resources created on or after this ISO 8601 datetime with time zone. A string, or an object with an epoch method. See "iso8601_date_time" in Twilio::Serialize.

date_created_before

Read only CompositionHook resources created before this ISO 8601 datetime with time zone. A string, or an object with an epoch method. See "iso8601_date_time" in Twilio::Serialize.

enabled

Read only CompositionHook resources with an enabled value that matches this parameter.

friendly_name

Read only CompositionHook resources with friendly names that match this string. The match is not case sensitive and can include asterisk * characters as wildcard match.

stream

my $stream = $client->video->v1->composition_hooks->stream(\%options, $limit, $page_size);

Takes the same arguments as "read", and returns a Twilio::Stream.

page

my $page = $client->video->v1->composition_hooks->page(\%options, $page_size, $page_token, $page_number);

Fetches one page, and returns a Twilio::Page.

get_page

my $page = $client->video->v1->composition_hooks->get_page($url);

Fetches the page at a URL given by Twilio.

get_context

my $context = $client->video->v1->composition_hooks->get_context($sid);

Returns a CompositionHookContext, and makes no request.

CompositionHookPage

A Twilio::Page of CompositionHookInstance objects.

records_key

build_instance

Used by Twilio::Page.

CompositionHookContext

Returned by $client->video->v1->composition_hooks($sid). It makes no request until one of these methods is called.

fetch

my $composition_hook = $client->video->v1->composition_hooks($sid)->fetch;

Returns a single CompositionHook resource identified by a CompositionHook SID. Returns a CompositionHookInstance.

update

my $composition_hook = $client->video->v1->composition_hooks($sid)->update($friendly_name, \%options);

Returns a CompositionHookInstance.

The required values are:

$friendly_name

A descriptive string that you create to describe the resource. It can be up to 100 characters long and it must be unique within the account.

The options are:

audio_sources

An array of track names from the same group room to merge into the compositions created by the composition hook. Can include zero or more track names. A composition triggered by the composition hook includes all audio sources specified in audio_sources except those specified in audio_sources_excluded. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, student* includes tracks named student as well as studentTeam. An array reference.

audio_sources_excluded

An array of track names to exclude. A composition triggered by the composition hook includes all audio sources specified in audio_sources except for those specified in audio_sources_excluded. The track names in this parameter can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, student* excludes student as well as studentTeam. This parameter can also be empty. An array reference.

enabled

Whether the composition hook is active. When true, the composition hook will be triggered for every completed Group Room in the account. When false, the composition hook never triggers.

format

One of mp4 or webm.

resolution

A string that describes the columns (width) and rows (height) of the generated composed video in pixels. Defaults to 640x480. The string's format is {width}x{height} where: * 16 <= {width} <= 1280 * 16 <= {height} <= 1280 * {width} * {height} <= 921,600 Typical values are: * HD = 1280x720 * PAL = 1024x576 * VGA = 640x480 * CIF = 320x240 Note that the resolution imposes an aspect ratio to the resulting composition. When the original video tracks are constrained by the aspect ratio, they are scaled to fit. See Specifying Video Layouts for more info.

status_callback

The URL we should call using the status_callback_method to send status information to your application on every composition event. If not provided, status callback events will not be dispatched.

status_callback_method

The HTTP method we should use to call status_callback. Can be: POST or GET and the default is POST. One of GET or POST.

trim

Whether to clip the intervals where there is no active media in the compositions triggered by the composition hook. The default is true. Compositions with trim enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See Specifying Video Layouts for more info.

video_layout

A JSON object that describes the video layout of the composition hook in terms of regions. See Specifying Video Layouts for more info. A hash or array reference, or a string of JSON.

delete

$client->video->v1->composition_hooks($sid)->delete;

Delete a Recording CompositionHook resource identified by a CompositionHook SID. Returns true.

CompositionHookInstance

See also Twilio::InstanceResource.

It has fetch, update and delete, which work as they do on the context.

Its fields are:

account_sid

The SID of the Account that created the CompositionHook resource.

audio_sources

The array of track names to include in the compositions created by the composition hook. A composition triggered by the composition hook includes all audio sources specified in audio_sources except those specified in audio_sources_excluded. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, student* includes tracks named student as well as studentTeam. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request

audio_sources_excluded

The array of track names to exclude from the compositions created by the composition hook. A composition triggered by the composition hook includes all audio sources specified in audio_sources except for those specified in audio_sources_excluded. The track names in this property can include an asterisk as a wild card character, which matches zero or more characters in a track name. For example, student* excludes student as well as studentTeam. This parameter can also be empty.

date_created

The date and time in GMT when the resource was created specified in ISO 8601 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

date_updated

The date and time in GMT when the resource was last updated specified in ISO 8601 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.

enabled

Whether the CompositionHook is active. When true, the CompositionHook is triggered for every completed Group Room on the account. When false, the CompositionHook is never triggered.

format

One of mp4 or webm.

friendly_name

The string that you assigned to describe the resource. Can be up to 100 characters long and must be unique within the account.

resolution

The dimensions of the video image in pixels expressed as columns (width) and rows (height). The string's format is {width}x{height}, such as 640x480.

sid

The unique string that we created to identify the CompositionHook resource.

status_callback

The URL we call using the status_callback_method to send status information to your application.

status_callback_method

The HTTP method we should use to call status_callback. Can be POST or GET and defaults to POST. One of GET or POST.

trim

Whether intervals with no media are clipped, as specified in the POST request that created the CompositionHook resource. Compositions with trim enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See Specifying Video Layouts for more info.

url

The absolute URL of the resource.

video_layout

A JSON object that describes the video layout of the composition in terms of regions as specified in the HTTP POST request that created the CompositionHook resource. See POST Parameters for more information. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request

CONSTRUCTORS

new

Objects here come from the methods above, so there is no need to call new directly.

LICENSE

Copyright (c) 2026 Francisco Zarabozo. Released under the MIT License.