Skip to main content

Relay.Calling.PlayResult

This object returned from one of synchronous play methods that represents the final result of a playing action.

Methods

getEvent

Returns the last Relay Event arrived for this operation.

Available In:

Parameters

None

Returns

Relay.Event - Last Relay Event.

Examples

Start playing an audio file and then grab the last event occurred.
<?php

$call->playAudio('https://cdn.signalwire.com/default-music/welcome.mp3')->done(function($result) {
$event = $result->getEvent();
// Inspect $event->payload ..
});

isSuccessful

Return true if the playing has succeeded, false otherwise.

Available In:

Parameters

None

Returns

boolean - Whether the playing has finished successfully.

Examples

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

$call->playAudio('https://cdn.signalwire.com/default-music/welcome.mp3')->done(function($result) {
if ($result->isSuccessful()) {
// Do other things...
}
});