diff --git a/livekit/types.go b/livekit/types.go index d93c5617..bfd9aeb3 100644 --- a/livekit/types.go +++ b/livekit/types.go @@ -14,6 +14,11 @@ package livekit +import ( + "github.com/bufbuild/protoyaml-go" + "gopkg.in/yaml.v3" +) + type TrackID string type ParticipantID string type ParticipantIdentity string @@ -66,3 +71,13 @@ func (p *SipDTMF) ToProto() *DataPacket { }, } } + +func (r *RoomEgress) UnmarshalYAML(value *yaml.Node) error { + // Marshall the Node back to yaml to pass it to the protobuf specific unmarshaller + str, err := yaml.Marshal(value) + if err != nil { + return err + } + + return protoyaml.Unmarshal(str, r) +} diff --git a/livekit/types_test.go b/livekit/types_test.go new file mode 100644 index 00000000..ed6f552f --- /dev/null +++ b/livekit/types_test.go @@ -0,0 +1,40 @@ +package livekit + +import ( + fmt "fmt" + "testing" + + "github.com/stretchr/testify/require" + "gopkg.in/yaml.v3" +) + +func TestUnmarshallRoomEgress(t *testing.T) { + y := ` +a: + room: + room_name: room name +b: + participant: + file_outputs: + - s3: + access_key: key +` + + obj := make(map[string]*RoomEgress) + + err := yaml.Unmarshal([]byte(y), &obj) + + fmt.Println(obj) + + require.NoError(t, err) + require.Equal(t, 2, len(obj)) + + re := obj["a"] + require.NotNil(t, re) + require.Equal(t, re.Room.RoomName, "room name") + + re = obj["b"] + require.NotNil(t, re) + require.Equal(t, 1, len(re.Participant.FileOutputs)) + require.Equal(t, "key", re.Participant.FileOutputs[0].Output.(*EncodedFileOutput_S3).S3.AccessKey) +} diff --git a/protobufs/livekit_room.proto b/protobufs/livekit_room.proto index cadbd8a8..ca0c92a2 100644 --- a/protobufs/livekit_room.proto +++ b/protobufs/livekit_room.proto @@ -60,15 +60,6 @@ service RoomService { // Update room metadata, will cause updates to be broadcasted to everyone in the room, Requires `roomAdmin` rpc UpdateRoomMetadata (UpdateRoomMetadataRequest) returns (Room); - - // Create a room configuration. - rpc CreateRoomConfiguration(CreateRoomConfigurationRequest) returns (RoomConfiguration); - - // Update a room configuration - rpc UpdateRoomConfiguration(UpdateRoomConfigurationRequest) returns (RoomConfiguration); - - // List configurations - rpc ListRoomConfiguration(ListRoomConfigurationRequest) returns (ListRoomConfigurationResponse); } message CreateRoomRequest { @@ -210,38 +201,6 @@ message UpdateRoomMetadataRequest { string metadata = 2; } -message CreateRoomConfigurationRequest { - RoomConfiguration configuration = 1; -} - -message UpdateRoomConfigurationRequest { - string name = 1; // configuration to update - // number of seconds to keep the room open if no one joins - optional uint32 empty_timeout = 2; - // number of seconds to keep the room open after everyone leaves - optional uint32 departure_timeout = 3; - // limit number of participants that can be in a room - optional uint32 max_participants = 4; - // egress - optional RoomEgress egress = 5; - // agent - optional RoomAgent agent = 6; - // playout delay of subscriber - optional uint32 min_playout_delay = 7; - optional uint32 max_playout_delay = 8; - // improves A/V sync when playout_delay set to a value larger than 200ms. It will disables transceiver re-use - // so not recommended for rooms with frequent subscription changes - optional bool sync_streams = 9; -} - -message ListRoomConfigurationRequest { - string name = 1; // If non empty, return only the configurartion with this name -} - -message ListRoomConfigurationResponse { - repeated RoomConfiguration configurations = 1; -} - message RoomConfiguration { string name = 1; // Used as ID, must be unique // number of seconds to keep the room open if no one joins