set human name in livekit room context
This commit is contained in:
@@ -8,7 +8,8 @@ import (
|
||||
)
|
||||
|
||||
type Client interface {
|
||||
GetJoinToken(roomId string, identity string) (string, error)
|
||||
// Name will show up in the participant data
|
||||
GetJoinToken(roomId string, humanId string, name string) (string, error)
|
||||
ServerUrl() string
|
||||
}
|
||||
|
||||
@@ -30,14 +31,15 @@ func (c *clientImpl) ServerUrl() string {
|
||||
return c.hostUrl
|
||||
}
|
||||
|
||||
func (c *clientImpl) GetJoinToken(room, identity string) (string, error) {
|
||||
func (c *clientImpl) GetJoinToken(room, humanId, name string) (string, error) {
|
||||
at := auth.NewAccessToken(c.apiKey, c.apiSecret)
|
||||
grant := &auth.VideoGrant{
|
||||
RoomJoin: true,
|
||||
Room: room,
|
||||
}
|
||||
at.SetVideoGrant(grant).
|
||||
SetIdentity(identity).
|
||||
SetIdentity(humanId).
|
||||
SetName(name).
|
||||
SetValidFor(time.Hour)
|
||||
|
||||
return at.ToJWT()
|
||||
|
||||
Reference in New Issue
Block a user