问题
I am working on a reactjs - Twilio video/chat application. Its a requirement to include the name of the person as a tag on top of the video.
However when I look at the json response with the participatory information - it only lists an identity id -- is there a way of pushing a name into the service, or doing a lookup on Twilio for the name of the person?
So where you have
identity: "17003", personName: "Bob Pip"
https://www.npmjs.com/package/twilio-video
I am able to get the sid and the identity.
During video connect tried to pump in a custom value for this localparticipant to push it into the service.
var connectOptions = {
name: roomName,
personName: 'Collin Baker',
logLevel: 'debug'
}
Video.connect(data.token, connectOptions)
but it doesn't come out.
"Hey, so, the short answer is "no" you can't do that through the Video SDK itself."
"However, I would recommend checking out Twilio Sync (https://www.twilio.com/docs/api/sync ). Sync is an API that let's you sync data across devices. So, you could create a sync object that contains the id that you use with the Video SDK paired with the user's visible name."
"They wouldn't link up directly, but if you keep your identities consistent (i.e. User Id from your db) and then keep the visible user name also in sync in the Sync object, then you can share that object between calling parties and display the names. You might, for example, also keep one sync document per video room."
https://www.twilio.com/docs/api/sync/sync-sdk-download
https://www.twilio.com/sync
https://www.twilio.com/docs/api/sync/quickstart-js
https://www.twilio.com/docs/api/sync/identity-and-access-tokens
"Ah, Sync is in beta, so you need to install the alpha version of the npm library. Slightly confusing I appreciate, it's something like twilio@3.4.0-alpha1"
来源:https://stackoverflow.com/questions/45059146/twilio-video-chat