Latest Legacy

Play audio on a MPC call

This endpoint allows you to play an audio file during an active call. Plivo supports .mp3 and .wav audio files.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Call/{call_uuid}/Play/


The member_id attribute that’s passed in the URL can be a member_id, a comma-separated list of member IDs on which this operation will be performed, or the string all. In the latter case, the play audio action is performed on all members of the MPC.

Arguments

urls Required

URL of the sound file to be played in .mp3 or .wav file.

Returns

Returns an acknowledgement that the audio is played to the MPC.

Response

HTTP Status Code: 202

{
    "api_id": "e05b5263-45dc-11eb-9014-0242ac110003",
    "message": "play queued into MPC",
    "mpcMemberId": [
        "1"
    ],
    "mpcName": "test_mpc_1"
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
require 'rubygems'
require 'plivo'
include Plivo
include Plivo::Exceptions

api = RestClient.new("<auth_id>","<auth_token>")
begin
  response = api.multipartycalls.start_play_audio(
    "friendly_name":"mpc_name",
    "member_id":"memberid",
    "url":"https://s3.amazonaws.com/plivocloud/music.mp3")
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end
1
2
3
4
5
6
7
8
9
10
11
12
var plivo = require('plivo');

(function main() {
    'use strict';

    var client = new plivo.Client('<auth_id>', '<auth_token>');
    client.multiPartyCalls.startPlayAudio(memberid,"https://s3.amazonaws.com/plivocloud/music.mp3",{'friendlyName': 'testmpc'}).then(function (response) {
        console.log(response);
    }, function (err) {
        console.error(err);
    });
})();
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php

require 'vendor/autoload.php';

use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;

$client = new RestClient("<auth_id>","<auth_token>");
try {
      $response = $client->multiPartyCalls->startPlayAudio
	     (
         "member_id",
         "https://s3.amazonaws.com/plivocloud/music.mp3",
          [
            "friendly_name" => "mpc_name"
          ]
        );
    print_r($response);
    }
catch (PlivoRestException $ex)
 {
   print_r($ex);
 }

print_r($response);
?>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
package com.plivo.examples.multipartycall;

import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.exceptions.PlivoValidationException;
import com.plivo.api.models.multipartycall.*;
import com.plivo.api.util.Utils;

import java.io.IOException;

public class UpdateParticipant {

  public static void main(String[] args) throws IOException, PlivoRestException, PlivoValidationException {
    Plivo.init("<auth_id>", "<auth_token>");
    try
    {
      MultiPartyCall.startPlayAudio(MultiPartyCallUtils.friendlyName("mpc_name"),"member_id").url("https://s3.amazonaws.com/plivocloud/music.mp3").update();
    }
    catch (Exception e)
    {
      e.printStackTrace();
    }

  }
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
using System;
using System.Collections.Generic;
using Plivo;
using Plivo.Exception;

namespace PlivoExamples
{
    internal class Program
    {
        public static void Main(string[] args)
        {
          var api = new PlivoApi("<auth_id>", "<auth_token>");
            var response = api.MultiPartyCall.StartPlayAudio(
                participantId:"member_id",
                friendlyName: "mpc_name",
                url: "https://s3.amazonaws.com/plivocloud/music.mp3"
             );
            Console.WriteLine(response);
        }
    }
}
1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN -X POST \
 -H "Content-Type: application/json" \
 -d '{"url":"https://s3.amazonaws.com/plivocloud/music.mp3"}' \
 https://api.plivo.com/v1/Account/{auth_id}/MultiPartyCall/name_{mpc_name}/Member/{member_id}/Play/
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package main

import (
	"fmt"

	"github.com/plivo/plivo-go/v7"
)

func main() {
	client, err := plivo.NewClient("<auth_id>", "<auth_token>", &plivo.ClientOptions{})
	if err != nil {
		panic(err)
	}
	var mutePointer = true
	response, err := client.MultiPartyCall.StartPlayAudio(plivo.MultiPartyCallParticipantParams{FriendlyName: "mpc_name", ParticipantId: "member_id"}, plivo.MultiPartyCallAudioParams{Url: "https://s3.amazonaws.com/plivocloud/music.mp3"})
	if err != nil {
		panic(err)
	}
	fmt.Printf("Response: %#v\n", response)
}