Latest Legacy

Play audio to a member

This API lets you play a .mp3 or .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 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 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('<auth_id>','<auth_token>')
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("<auth_id>","<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';
    
   // If auth id and auth token are not specified, Plivo will fetch them from the environment variables.
    var client = new plivo.Client("<auth_id>","<auth_token>");
    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("<auth_id>","<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("<auth_id>","<auth_token>");
        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("<auth_id>","<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
22
23
24
25
26
// Example for Conference Member Play create
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 {
		fmt.Print("Error", err.Error())
		return
	}
	response, err := client.Conferences.MemberPlay(
		"My Conf Room",
		"10",
		"https://s3.amazonaws.com/plivocloud/Trumpet.mp3",
	)
	if err != nil {
		fmt.Print("Error", err.Error())
		return
	}
	fmt.Printf("Response: %#v\n", response)
}