NAME
Twilio::Rest::Video::V1::Composition - The Composition resource
SYNOPSIS
my $client = Twilio::Rest::Client->new($account_sid, $auth_token);
my $composition = $client->video->v1->compositions->create($room_sid, \%options);
for my $composition ($client->video->v1->compositions->read({}, 20)) {
...
}
my $composition = $client->video->v1->compositions($sid)->fetch;
$client->video->v1->compositions($sid)->delete;
DESCRIPTION
Recording compositions
This file holds CompositionList, CompositionPage, CompositionContext and CompositionInstance. Methods that make a request throw Twilio::Exceptions::RestException on an error response.
CompositionList
Returned by $client->video->v1->compositions. See also Twilio::ListResource.
create
my $composition = $client->video->v1->compositions->create($room_sid, \%options);
Returns a CompositionInstance.
The required values are:
The options are:
audio_sources-
An array of track names from the same group room to merge into the new composition. Can include zero or more track names. The new composition includes all audio sources specified in
audio_sourcesexcept for those specified inaudio_sources_excluded. The track names in this parameter can include an asterisk as a wild card character, which will match zero or more characters in a track name. For example,student*includesstudentas well asstudentTeam. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request An array reference. audio_sources_excluded-
An array of track names to exclude. The new composition includes all audio sources specified in
audio_sourcesexcept for those specified inaudio_sources_excluded. The track names in this parameter can include an asterisk as a wild card character, which will match zero or more characters in a track name. For example,student*excludesstudentas well asstudentTeam. This parameter can also be empty. An array reference. format-
One of
mp4orwebm. 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 =320x240Note that theresolutionimposes 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_methodto 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:POSTorGETand the default isPOST. One ofGETorPOST. trim-
Whether to clip the intervals where there is no active media in the composition. The default is
true. Compositions withtrimenabled 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 in terms of regions. See Specifying Video Layouts for more info. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request A hash or array reference, or a string of JSON.
read
my @records = $client->video->v1->compositions->read(\%options, $limit, $page_size);
List of all Recording compositions. Returns the records as a list, fetching as many pages as it needs.
The options are:
date_created_after-
Read only Composition resources created on or after this ISO 8601 date-time with time zone. A string, or an object with an
epochmethod. See "iso8601_date_time" in Twilio::Serialize. date_created_before-
Read only Composition resources created before this ISO 8601 date-time with time zone. A string, or an object with an
epochmethod. See "iso8601_date_time" in Twilio::Serialize. room_sid-
Read only Composition resources with this Room SID.
status-
Read only Composition resources with this status. Can be:
enqueued,processing,completed,deleted, orfailed. One ofenqueued,processing,completed,deletedorfailed.
stream
my $stream = $client->video->v1->compositions->stream(\%options, $limit, $page_size);
Takes the same arguments as "read", and returns a Twilio::Stream.
page
my $page = $client->video->v1->compositions->page(\%options, $page_size, $page_token, $page_number);
Fetches one page, and returns a Twilio::Page.
get_page
my $page = $client->video->v1->compositions->get_page($url);
Fetches the page at a URL given by Twilio.
get_context
my $context = $client->video->v1->compositions->get_context($sid);
Returns a CompositionContext, and makes no request.
CompositionPage
A Twilio::Page of CompositionInstance objects.
records_key
build_instance
Used by Twilio::Page.
CompositionContext
Returned by $client->video->v1->compositions($sid). It makes no request until one of these methods is called.
fetch
my $composition = $client->video->v1->compositions($sid)->fetch;
Returns a single Composition resource identified by a Composition SID. Returns a CompositionInstance.
delete
$client->video->v1->compositions($sid)->delete;
Delete a Recording Composition resource identified by a Composition SID. Returns true.
CompositionInstance
See also Twilio::InstanceResource.
It has fetch and delete, which work as they do on the context.
Its fields are:
- account_sid
-
The SID of the Account that created the Composition resource.
- audio_sources
-
The array of track names to include in the composition. The composition includes all audio sources specified in
audio_sourcesexcept those specified inaudio_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 namedstudentas well asstudentTeam. - audio_sources_excluded
-
The array of track names to exclude from the composition. The composition includes all audio sources specified in
audio_sourcesexcept for those specified inaudio_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*excludesstudentas well asstudentTeam. This parameter can also be empty. - bitrate
-
The average bit rate of the composition's media.
- date_completed
-
The date and time in GMT when the composition's media processing task finished, specified in ISO 8601 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.
- 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_deleted
-
The date and time in GMT when the composition generated media was deleted, specified in ISO 8601 format. A Time::Piece object in UTC. See "date_time" in Twilio::Deserialize.
- duration
-
The duration of the composition's media file in seconds.
- format
-
One of
mp4orwebm. - links
-
The URL of the media file associated with the composition.
- media_external_location
-
The URL of the media file associated with the composition when stored externally. See External S3 Compositions for more details.
- 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 as640x480. - room_sid
-
The SID of the Group Room that generated the audio and video tracks used in the composition. All media sources included in a composition must belong to the same Group Room.
- sid
-
The unique string that we created to identify the Composition resource.
- size
-
The size of the composed media file in bytes.
- status
-
One of
enqueued,processing,completed,deletedorfailed. - status_callback
-
The URL called using the
status_callback_methodto send status information on every composition event. - status_callback_method
-
The HTTP method used to call
status_callback. Can be:POSTorGET, defaults toPOST. One ofGETorPOST. - trim
-
Whether to remove intervals with no media, as specified in the POST request that created the composition. Compositions with
trimenabled 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
-
An object that describes the video layout of the composition in terms of regions. See Specifying Video Layouts for more info.
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.