Create a room composition.
Asynchronously create a room composition.
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const roomComposition = await client.roomCompositions.create();
console.log(roomComposition.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
room_composition = client.room_compositions.create()
print(room_composition.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
roomComposition, err := client.RoomCompositions.New(context.TODO(), telnyx.RoomCompositionNewParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", roomComposition.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.roomcompositions.RoomCompositionCreateParams;
import com.telnyx.sdk.models.roomcompositions.RoomCompositionCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
RoomCompositionCreateResponse roomComposition = client.roomCompositions().create();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
room_composition = telnyx.room_compositions.create
puts(room_composition)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$roomComposition = $client->roomCompositions->create(
format: 'mp4',
resolution: '800x600',
sessionID: '0ccc7b54-4df3-4bca-a65a-3da1ecc777b0',
videoLayout: [
'foo' => [
'height' => 360,
'maxColumns' => 3,
'maxRows' => 3,
'videoSources' => ['7b61621f-62e0-4aad-ab11-9fd19e272e73'],
'width' => 480,
'xPos' => 100,
'yPos' => 100,
'zPos' => 1,
],
],
webhookEventFailoverURL: 'https://failover.example.com',
webhookEventURL: 'https://example.com',
webhookTimeoutSecs: 25,
);
var_dump($roomComposition);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx room-compositions create \
--api-key 'My API Key'curl --request POST \
--url https://api.telnyx.com/v2/room_compositions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"format": "mp4",
"resolution": "800x600",
"session_id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777b0",
"video_layout": {},
"webhook_event_url": "https://example.com",
"webhook_event_failover_url": "https://failover.example.com",
"webhook_timeout_secs": 25
}
'{
"data": {
"completed_at": "2022-02-25T05:39:56.377426Z",
"download_url": "https://example.com",
"duration_secs": 84,
"ended_at": "2022-02-24T23:22:24.577677Z",
"format": "mp4",
"id": "7103dc53-ee59-4b54-a58b-c77d99ceb037",
"record_type": "composition",
"resolution": "1280x720",
"room_id": "f981dbb3-228a-44e9-ac54-e87f0e2658b0",
"session_id": "8f728d7b-00e2-4c59-8c27-f564b828df87",
"size_mb": 6,
"started_at": "2022-02-24T23:21:00.077209Z",
"status": "enqueued",
"user_id": "12a04ec9-0f91-4a91-9f3a-a19d9931182e",
"video_layout": {
"first": {
"height": 720,
"video_sources": [
"7b61621f-62e0-4aad-ab11-9fd19e272e73"
],
"width": 1280,
"x_pos": 0,
"y_pos": 0,
"z_pos": 0
}
},
"webhook_event_url": "https://webhook.site/544663ce-b692-4f9c-80ed-e5ad97cd5c02"
}
}{
"errors": [
{
"code": "10027",
"title": "Unprocessable Entity",
"detail": "The server understood the syntax of the request but was unable to process the instructions."
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Parameters that can be defined during room composition creation.
The desired format of the room composition.
"mp4"
The desired resolution (width/height in pixels) of the resulting video of the room composition. Both width and height are required to be between 16 and 1280; and width * height should not exceed 1280 * 720
"800x600"
id of the room session associated with the room composition.
"0ccc7b54-4df3-4bca-a65a-3da1ecc777b0"
Describes the video layout of the room composition in terms of regions.
Show child attributes
Show child attributes
The URL where webhooks related to this room composition will be sent. Must include a scheme, such as 'https'.
"https://example.com"
The failover URL where webhooks related to this room composition will be sent if sending to the primary URL fails. Must include a scheme, such as 'https'.
"https://failover.example.com"
Specifies how many seconds to wait before timing out a webhook.
0 <= x <= 3025
Response
Create room composition response.
Show child attributes
Show child attributes
{
"completed_at": "2022-02-25T05:39:56.377426Z",
"download_url": "https://example.com",
"duration_secs": 84,
"ended_at": "2022-02-24T23:22:24.577677Z",
"format": "mp4",
"id": "7103dc53-ee59-4b54-a58b-c77d99ceb037",
"record_type": "composition",
"resolution": "1280x720",
"room_id": "f981dbb3-228a-44e9-ac54-e87f0e2658b0",
"session_id": "8f728d7b-00e2-4c59-8c27-f564b828df87",
"size_mb": 6,
"started_at": "2022-02-24T23:21:00.077209Z",
"status": "enqueued",
"user_id": "12a04ec9-0f91-4a91-9f3a-a19d9931182e",
"video_layout": {
"first": {
"height": 720,
"video_sources": ["7b61621f-62e0-4aad-ab11-9fd19e272e73"],
"width": 1280,
"x_pos": 0,
"y_pos": 0,
"z_pos": 0
}
},
"webhook_event_url": "https://webhook.site/544663ce-b692-4f9c-80ed-e5ad97cd5c02"
}
Was this page helpful?
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const roomComposition = await client.roomCompositions.create();
console.log(roomComposition.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
room_composition = client.room_compositions.create()
print(room_composition.data)
package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
roomComposition, err := client.RoomCompositions.New(context.TODO(), telnyx.RoomCompositionNewParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", roomComposition.Data)
}
package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.roomcompositions.RoomCompositionCreateParams;
import com.telnyx.sdk.models.roomcompositions.RoomCompositionCreateResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
RoomCompositionCreateResponse roomComposition = client.roomCompositions().create();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
room_composition = telnyx.room_compositions.create
puts(room_composition)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$roomComposition = $client->roomCompositions->create(
format: 'mp4',
resolution: '800x600',
sessionID: '0ccc7b54-4df3-4bca-a65a-3da1ecc777b0',
videoLayout: [
'foo' => [
'height' => 360,
'maxColumns' => 3,
'maxRows' => 3,
'videoSources' => ['7b61621f-62e0-4aad-ab11-9fd19e272e73'],
'width' => 480,
'xPos' => 100,
'yPos' => 100,
'zPos' => 1,
],
],
webhookEventFailoverURL: 'https://failover.example.com',
webhookEventURL: 'https://example.com',
webhookTimeoutSecs: 25,
);
var_dump($roomComposition);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx room-compositions create \
--api-key 'My API Key'curl --request POST \
--url https://api.telnyx.com/v2/room_compositions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"format": "mp4",
"resolution": "800x600",
"session_id": "0ccc7b54-4df3-4bca-a65a-3da1ecc777b0",
"video_layout": {},
"webhook_event_url": "https://example.com",
"webhook_event_failover_url": "https://failover.example.com",
"webhook_timeout_secs": 25
}
'{
"data": {
"completed_at": "2022-02-25T05:39:56.377426Z",
"download_url": "https://example.com",
"duration_secs": 84,
"ended_at": "2022-02-24T23:22:24.577677Z",
"format": "mp4",
"id": "7103dc53-ee59-4b54-a58b-c77d99ceb037",
"record_type": "composition",
"resolution": "1280x720",
"room_id": "f981dbb3-228a-44e9-ac54-e87f0e2658b0",
"session_id": "8f728d7b-00e2-4c59-8c27-f564b828df87",
"size_mb": 6,
"started_at": "2022-02-24T23:21:00.077209Z",
"status": "enqueued",
"user_id": "12a04ec9-0f91-4a91-9f3a-a19d9931182e",
"video_layout": {
"first": {
"height": 720,
"video_sources": [
"7b61621f-62e0-4aad-ab11-9fd19e272e73"
],
"width": 1280,
"x_pos": 0,
"y_pos": 0,
"z_pos": 0
}
},
"webhook_event_url": "https://webhook.site/544663ce-b692-4f9c-80ed-e5ad97cd5c02"
}
}{
"errors": [
{
"code": "10027",
"title": "Unprocessable Entity",
"detail": "The server understood the syntax of the request but was unable to process the instructions."
}
]
}