Skip to main content

Play Streaming

The playStream action allows you to stream an audio file in base64 format to the caller. This can be used to greet the caller with specific pre-recorded music or to play audio during the call. Supported audio types include raw, mp3, wav, and ogg formats. You can also specify the desired audio quality by setting the sample rate.

To stream base64-encoded audio during a call using the PIOPIY PCMO platform, you can use the playStream method of the StreamAction class. The method requires the base64-encoded audio file, the audio type (e.g., raw, mp3, wav, ogg), and the desired sample rate.

const { StreamAction } = require("piopiy");

const stream = new StreamAction();

stream.playStream("Your base64 audio data", "raw", 8000);

Parameters type and description

ParameterTypeDescription
audio_base64stringThe base64-encoded audio data to be streamed. Ensure it is a valid base64 string representing the audio content.
audio_typestringThe type of the audio file. Supported formats are raw, mp3, wav, and ogg.
sample_ratenumberThe desired voice quality in bits per second. Options are 8000, 16000.