Play audio to a member

This API lets you play a mp3 or a wav file to a member in the conference.

API Endpoint

POST https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_name}/Member/{member_id}/Play/


The member_id attribute which is passed in the URL can be one of the following three forms:

  1. Member ID: The member specified by the member_id.

  2. Comma separated list of member IDs: List of member IDs on which this operation will be performed.

  3. ‘all’: The string ‘all’, this action will be performed on all members of the conference.

Attributes

url Required

URL of the sound file to be played.

Returns

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

Response

HTTP Status Code: 202

{
  "message" : "play queued into conference",
  "api_id" : "4e44bd4e-f830-11e6-b886-067c5485c240",
  "member_id" : "[u'160005', u'160004', u'160003', u'160002']"
}

Example Request

1
2
3
4
5
6
7
8
import plivo

client = plivo.RestClient()
response = client.conferences.member_play(
    conference_name='testing',
    member_id=28485,
    url='https://s3.amazonaws.com/plivocloud/music.mp3')
print(response)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#
# Example for Conference Member Play Create
#
require 'rubygems'
require 'plivo'

include Plivo
include Plivo::Exceptions

api = RestClient.new("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN")

begin
  response = api.conferences.play_member(
    'My Conf Room',
    [10],
    'https://s3.amazonaws.com/plivocloud/Trumpet.mp3'
  )
  puts response
rescue PlivoRESTError => e
  puts 'Exception: ' + e.message
end
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// Example for Conference Member Play create

var plivo = require('plivo');

(function main() {
    'use strict';
    
    // As the auth_id and auth_token are unspecified, Plivo will fetch them from the PLIVO_AUTH_ID and PLIVO_AUTH_TOKEN environment variables.
    var client = new plivo.Client();
    client.conferences.playAudioToMember(
        "My Conf Room", // conference name
        10, // member id
        "https://s3.amazonaws.com/plivocloud/Trumpet.mp3", // url
    ).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
<?php
/**
 * Example for Conference Member Play create
 */
require 'vendor/autoload.php';
use Plivo\RestClient;
use Plivo\Exceptions\PlivoRestException;
$client = new RestClient("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN");

try {
    $response = $client->conferences->startPlaying(
        'My Conf Room',
        [10,11],
        'https://s3.amazonaws.com/plivocloud/Trumpet.mp3'
    );
    print_r($response);
}
catch (PlivoRestException $ex) {
    print_r(ex);
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.plivo.api.samples.conference.member.play;

import java.io.IOException;
import com.plivo.api.Plivo;
import com.plivo.api.exceptions.PlivoRestException;
import com.plivo.api.models.conference.Conference;
import com.plivo.api.models.conference.ConferenceMemberActionResponse;

/**
* Example for Conference Member Play create
*/
class PlayCreate {
    public static void main(String [] args) {
        Plivo.init();
        try {
            ConferenceMemberActionResponse response = Conference.memberPlayer("My Conf Room", "10", "https://s3.amazonaws.com/plivocloud/Trumpet.mp3")
                .create();

            System.out.println(response);
        } catch (PlivoRestException | IOException e) {
            e.printStackTrace();
        }
    }
}
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
27
28
29
30
31
/**
 * Example for Conference Member Play Create
 */
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("YOUR_AUTH_ID", "YOUR_AUTH_TOKEN");
            try
            {
                var response = api.Conference.PlayMember(
                    url:"https://s3.amazonaws.com/plivocloud/Trumpet.mp3",
                    memberId:new List<string>(){"10","11"},
                    conferenceName:"My Conf Room"
                );
                Console.WriteLine(response);
            }
            catch (PlivoRestException e)
            {
                Console.WriteLine("Exception: " + e.Message);
            }
        }
    }
}
1
2
3
4
curl -i --user AUTH_ID:AUTH_TOKEN \
    -H "Content-Type: application/json" \
    -d '{"url":"https://s3.amazonaws.com/plivocloud/Trumpet.mp3"}' \
    https://api.plivo.com/v1/Account/{auth_id}/Conference/{conference_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
21
// Example for Conference Member Play create
package main

import "fmt"
import "github.com/plivo/plivo-go"
 
func main() {
	client, err := plivo.NewClient("", "", &plivo.ClientOptions{})
	if err != nil {
		panic(err)
	}
	response, err := client.Conferences.MemberPlay(
		"My Conf Room",
		"10",
		"https://s3.amazonaws.com/plivocloud/Trumpet.mp3",
	)
	if err != nil {
		panic(err)
	}
	fmt.Printf("Response: %#v\n", response)
}