Play audio in Bridge
Play an audio file or speak a sentence in a bridge.
Request URL
POST
https://api.catapult.inetwork.com/v1/users/{userId}/bridges/{bridgeId}/audio
Supported Parameters
Parameter | Description | Mandatory |
---|---|---|
fileUrl | The location of an audio file to play (WAV and MP3 supported). To STOP AUDIO FILE PLAYBACK send an empty string like: {"fileUrl": ""} |
No |
sentence | The sentence to speak MAXIMUM LENGTH 1000 CHARACTERS. To STOP SENTENCE PLAYBACK send an empty string like: {"sentence": ""} |
No |
gender | The gender of the voice used to synthesize the sentence. It will be considered only if sentence is not null. The female gender will be used by default. | No |
locale | The locale used to get the accent of the voice used to synthesize the sentence. Currently audio supports: - en_US or en_UK (English) - es or es_MX (Spanish) - fr or fr_FR (French) - de or de_DE (German) - t or it_IT (Italian) It will be considered only if sentence is not null/empty. The en_US will be used by default. |
No |
voice | The voice to speak the sentence. Audio currently supports the following voices: - English US: Kate, Susan, Julie, Dave, Paul - English UK: Bridget - Spanish: Esperanza, Violeta, Jorge - French: Jolie, Bernard - German: Katrin, Stefan - Italian: Paola, Luca It will be considered only if sentence is not null/empty. Susan’s voice will be used by default. |
No |
Example 1 of 4: Play an Audio file
curl -v -X POST https://api.catapult.inetwork.com/v1/users/{userId}/bridges/{bridgeId}/audio -u {token}:{secret} -H "Content-type: application/json" -d
'
{
"fileUrl": "http://example.com/audio.mp3"
}
'
//Play Audio file on bridge
//Promise
client.Bridge.playAudioFile("bridgeID", "http://myurl.com/file.mp3").then(function (res) {});
//Callback
client.Bridge.playAudioFile("bridgeID", "http://myurl.com/file.wav", function (err, res) {});
await client.Bridge.PlayAudioFileAsync("bridgeID", "http://myurl.com/file.wav");
bridge.play_audio({:file_url => "http://myurl.com/file.wav"})
Example 2 of 4: Stop an Audio File Playing
curl -v -X POST https://api.catapult.inetwork.com/v1/users/{userId}/bridges/{bridgeId}/audio -u {token}:{secret} -H "Content-type: application/json" -d '{"fileUrl": ""}'
//Promise
client.Bridge.stopAudioFilePlayback("bridgeID").then(function (res) {});
//Callback
client.Bridge.stopAudioFilePlayback("bridgeID", function (err, res) {});
await client.Bridge.PlayAudioFileAsync("brg-65dhmbasiei", "");
bridge.play_audio({:file_url => ""})
Example 3 of 4: Speak a Sentence
curl -v -X POST https://api.catapult.inetwork.com/v1/users/{userId}/bridges/{bridgeId}/audio -u {token}:{secret} -H "Content-type: application/json" -d '
{
"gender": "female",
"sentence": "Hello, thank you for calling.",
"locale": "en_US",
"voice": "julie"
}'
//Speak sentence with options
var options = {
sentence : "hola de Bandwidth",
gender : "male",
locale : "es",
voice : "Jorge"
}
//Promise
client.Bridge.playAudioAdvanced("bridgeId", options).then(function (res) {});
//Callback
client.Bridge.playAudioAdvanced("bridgeId", options, function (err,res) {});
//Speak sentence in a bridge
//Promise
client.Bridge.speakSentence("bridgeID", "Hello From Bandwidth").then(function (res) {});
//Callback
client.Bridge.speakSentence("bridgeID", "Hello From Bandwidth", function (err, res) {});
await client.Bridge.SpeakSentenceAsync("brg-65dhmbasiei", "Hello From Bandwidth");
bridge.play_audio({:sentence => "Hello from Bandwidth"})
Example 4 of 4: Stop a Sentence
curl -v -X POST https://api.catapult.inetwork.com/v1/users/{userId}/bridges/{bridgeId}/audio -u {token}:{secret} -H "Content-type: application/json" -d
'
{"sentence": ""}
'
//Promise
client.Bridge.stopSpeaking("bridgeID").then(function (res) {});
//Callback
client.Bridge.stopSpeaking("bridgeID", function (err, res) {});
await client.Bridge.SpeakSentenceAsync("brg-65dhmbasiei", "");
bridge.play_audio({:sentence => ""})