Media player
VoxEngine provides the Player module which allows you to play media files and text-to-speech blocks.
To use Player during an incoming call, first answer a call. You can use the startEarlyMedia method to broadcast speech before the call is answered to create a greeting or a voicemail prompt.
Use the createTTSPlayer() function to create a text-to-speech player. It accepts the same arguments as the speech synthesis say() method. Refer to the speech synthesis article to learn about this method usage.
Use the createURLPlayer method to play media files. It accepts two arguments: the first is the media file URL string, the second argument is URLPlayerOptions. Follow this link to learn about player options.
After you created a TTS or an URL player, you need to broadcast it to an active call via the sendMediaTo method.
Refer to the code example below to understand how the Player module works:
Please note, that the maximum number of media players per JS session (one scenario) is 10.