跳转到主要内容
POST
/
room
/
{id}
/
user
Go
package main

import(
	livepeergo "github.com/livepeer/livepeer-go"
	"context"
	"github.com/livepeer/livepeer-go/models/components"
	"log"
)

func main() {
    s := livepeergo.New(
        livepeergo.WithSecurity("<YOUR_BEARER_TOKEN_HERE>"),
    )

    ctx := context.Background()
    res, err := s.Room.CreateUser(ctx, "<id>", components.RoomUserPayload{
        Name: "name",
        CanPublish: livepeergo.Bool(true),
        CanPublishData: livepeergo.Bool(true),
    })
    if err != nil {
        log.Fatal(err)
    }
    if res.RoomUserResponse != nil {
        // handle response
    }
}
{
  "id": "d32ae9e6-c459-4931-9898-e86e2f5e7e16",
  "joinUrl": "https://meet.livepeer.chat",
  "token": "token"
}

创建房间用户

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

路径参数

id
string
必填

请求体

application/json
name
string
必填

Display name

示例:

"name"

canPublish
boolean

Whether a user is allowed to publish audio/video tracks

示例:

true

canPublishData
boolean

Whether a user is allowed to publish data messages to the room

示例:

true

metadata
string

User defined payload to store for the participant

响应

Success

id
string

The ID of the user

示例:

"d32ae9e6-c459-4931-9898-e86e2f5e7e16"

joinUrl
string

Joining URL - use this for Livepeer's default meeting app (see the multiparticipant streaming guide for more info).

示例:

"https://meet.livepeer.chat"

token
string

Joining JWT - this can be used if you have a custom meeting app (see the multiparticipant streaming guide for more info).

示例:

"token"

Last modified on March 1, 2026