Record Result

View as Markdown

Relay.Calling.RecordResult

This object returned from record method that represents the final result of a recording.

Methods

getDuration

Returns the duration of the recording in seconds.

Parameters

None

Returns

number - Duration of the recording in seconds.

Examples

Start recording and use the duration.

1<?php
2
3$params = [
4 'stereo' => true
5];
6$call->record($params)->done(function($result) {
7 if ($result->isSuccessful()) {
8 $duration = $result->getDuration();
9 }
10});

getEvent

Returns the last Relay Event arrived for this operation.

Parameters

None

Returns

Relay.Event - Last Relay Event.

Examples

Start recording in stereo mode and grab the result when it’s completed.

1<?php
2
3$params = [
4 'stereo' => true
5];
6$call->record($params)->done(function($result) {
7 $event = $result->getEvent();
8 // Inspect $event->payload ..
9});

getSize

Returns the size of the recording file.

Parameters

None

Returns

number - Size of the recording file.

Examples

Start recording and use the size of the file.

1<?php
2
3$params = [
4 'stereo' => true
5];
6$call->record($params)->done(function($result) {
7 if ($result->isSuccessful()) {
8 $size = $result->getSize();
9 }
10});

getUrl

Returns the HTTPS URL to the recording file.

Parameters

None

Returns

string - HTTPS URL to the file.

Examples

Start recording and use the URL.

1<?php
2
3$params = [
4 'stereo' => true
5];
6$call->record($params)->done(function($result) {
7 if ($result->isSuccessful()) {
8 $httpsUrl = $result->getUrl();
9 }
10});

isSuccessful

Return true if the recording succeeded, false otherwise.

Parameters

None

Returns

boolean - True/False accordingly to the state.

Examples

Start the recording and then check if it has ended successfully.

1<?php
2
3$params = [
4 'stereo' => true
5];
6$call->record($params)->done(function($result) {
7 if ($result->isSuccessful()) {
8 // Recording completed with success
9 }
10});