diff --git a/cmd/livekit-cli/room.go b/cmd/livekit-cli/room.go index 960e08bc..a7eedd06 100644 --- a/cmd/livekit-cli/room.go +++ b/cmd/livekit-cli/room.go @@ -52,6 +52,11 @@ var ( Usage: "AutoTrackEgress json file (see examples/auto-track-egress.json)", Required: false, }, + &cli.UintFlag{ + Name: "min-playout-delay", + Usage: "minimum playout delay", + Required: false, + }, ), }, { @@ -61,6 +66,15 @@ var ( Category: roomCategory, Flags: withDefaultFlags(), }, + { + Name: "list-room", + Before: createRoomClient, + Action: listRoom, + Category: roomCategory, + Flags: withDefaultFlags( + roomFlag, + ), + }, { Name: "delete-room", Before: createRoomClient, @@ -235,6 +249,11 @@ func createRoom(c *cli.Context) error { req.Egress.Tracks = trackEgress } + if c.Uint("min-playout-delay") != 0 { + fmt.Printf("setting min playout delay: %d\n", c.Uint("min-playout-delay")) + req.MinPlayoutDelay = uint32(c.Uint("min-playout-delay")) + } + room, err := roomClient.CreateRoom(context.Background(), req) if err != nil { return err @@ -258,6 +277,26 @@ func listRooms(c *cli.Context) error { return nil } +func listRoom(c *cli.Context) error { + res, err := roomClient.ListRooms(context.Background(), &livekit.ListRoomsRequest{ + Names: []string{c.String("room")}, + }) + if err != nil { + return err + } + if len(res.Rooms) == 0 { + fmt.Printf("there is no matching room with name: %s\n", c.String("room")) + return nil + } + rm := res.Rooms[0] + PrintJSON(rm) + playoutDelay := rm.GetPlayoutDelay() + if playoutDelay != nil { + fmt.Printf("playout delay: %s\n", playoutDelay.String()) + } + return nil +} + func deleteRoom(c *cli.Context) error { roomId := c.String("room") _, err := roomClient.DeleteRoom(context.Background(), &livekit.DeleteRoomRequest{