Play Result

View as Markdown

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.

Parameters

None

Returns

Relay.Event - Last Relay Event.

Examples

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

1<?php
2
3$call->playAudio('https://cdn.signalwire.com/default-music/welcome.mp3')->done(function($result) {
4 $event = $result->getEvent();
5 // Inspect $event->payload ..
6});

isSuccessful

Return true if the playing has succeeded, false otherwise.

Parameters

None

Returns

boolean - Whether the playing has finished successfully.

Examples

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

1<?php
2
3$call->playAudio('https://cdn.signalwire.com/default-music/welcome.mp3')->done(function($result) {
4 if ($result->isSuccessful()) {
5 // Do other things...
6 }
7});