Play Music
To play an audio file or URL during a call using the PIOPIY PCMO platform, you can use the playMusic method of the PiopiyAction class. The playMusic method takes an audio file or a URL and plays it during an active call.
playMusic(audioFileOrUrl)
| parameter | Type | Description |
|---|---|---|
| audioFileOrUrl | string | The URL or path to the audio file that should be played during the call |
Example Implementation
- The following example demonstrates how to play a specific audio file or URL during a call by using the
playMusicmethod:
- Node.js
- Python
const { PiopiyAction } = require("piopiy");
const action = new PiopiyAction();
action.playMusic("https://example.com/your_music_file.wav");
from piopiy import Action
# Create an instance of the Action class
action = Action()
action.playMusic("https://example.com/your_music_file.wav")