I am here to ask you about Twilio functionality. Now I am developing Conference Service using Twilio Service, but faced a difficult problem. When I use connect API, the callback returns a JSON object that includes participant.identity. I want to send participant.name with participant.identity.
This is connect function.
createLocalTracks(options)
.then(localTracks => {
return connect(room.accessToken, {
name: room.roomName,
tracks: localTracks,
})
}).then(room => {
console.log(room.data); // Returns JSON Object that includes only participant_identity.
this.participants.push("You");
})
And console result is like the following.
{
dominantSpeaker: null
isRecording: true
localParticipant: {
...,
identity: 'xxx',
...
}
mediaRegion: "us1"
name: "Soundblock.Project.2608117C-F92E-442A-A67D-4ED428522CE0"
participants: []
sid: "RM6336d72cb198fa58aa37f66af9eaf02d"
state: "connected"
}
I want to get participant_name with identity. So the result must be like the following.
{
dominantSpeaker: null
isRecording: true
localParticipant: {
...,
identity: 'xxx',
participant_name: 'ABC'
...
}
mediaRegion: "us1"
name: "Soundblock.Project.2608117C-F92E-442A-A67D-4ED428522CE0"
participants: [
{ identity: 'YYY', participant_name: 'BCD' },
{ identity: 'ZZZ', participant_name: 'CDE' },
...
]
sid: "RM6336d72cb198fa58aa37f66af9eaf02d"
state: "connected"
}
Is there anyone who can help me with this issue? Thank you.
Twilio developer evangelist here.
The
Participant
object does not have arbitrary properties, likeparticipant_name
, that you can use to pass data around.I would suggest that you create an API in your back-end that can receive a participant identity and return data about the participant. That way, when a participant connects you can make a request to your back-end to get more data about them.
Alternatively, you could use the DataTrack API to send data like this to other participants.