Skip to content

Commit e2aaae4

Browse files
committed
Livestream mode, improved client-side auth
1 parent 3892d26 commit e2aaae4

File tree

4 files changed

+50
-27
lines changed

4 files changed

+50
-27
lines changed

auth/grants.go

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,29 @@ import (
2323
)
2424

2525
type VideoGrant struct {
26-
// actions on rooms
26+
// ---- actions on rooms
27+
28+
// ability to create rooms, typically used only for CreateRoom API
2729
RoomCreate bool `json:"roomCreate,omitempty"`
28-
RoomList bool `json:"roomList,omitempty"`
30+
// ability to retrieve read-only information about rooms
31+
RoomList bool `json:"roomList,omitempty"`
32+
// ability to record any room
33+
// this permission is too broad, and will be replaced by roomEgress, which is applied to a specific room
2934
RoomRecord bool `json:"roomRecord,omitempty"`
35+
// actions on ingresses
36+
IngressAdmin bool `json:"ingressAdmin,omitempty"` // applies to all ingress
37+
38+
// ---- actions on a single room
3039

31-
// actions on a particular room
32-
RoomAdmin bool `json:"roomAdmin,omitempty"`
33-
RoomJoin bool `json:"roomJoin,omitempty"`
34-
Room string `json:"room,omitempty"`
40+
Room string `json:"room,omitempty"`
41+
// can token holder perform admin operations on the room
42+
RoomAdmin bool `json:"roomAdmin,omitempty"`
43+
// can token holder join the room as a participant
44+
RoomJoin bool `json:"roomJoin,omitempty"`
45+
// can start egress sessions from the room
46+
RoomEgress bool `json:"roomEgress,omitempty"`
47+
48+
// ---- activity allowed by a participant with roomJoin
3549

3650
// permissions within a room, if none of the permissions are set explicitly
3751
// it will be granted with all publish and subscribe permissions
@@ -44,8 +58,7 @@ type VideoGrant struct {
4458
// by default, a participant is not allowed to update its own metadata
4559
CanUpdateOwnMetadata *bool `json:"canUpdateOwnMetadata,omitempty"`
4660

47-
// actions on ingresses
48-
IngressAdmin bool `json:"ingressAdmin,omitempty"` // applies to all ingress
61+
// ---- attributes on a participant
4962

5063
// participant is not visible to other participants
5164
Hidden bool `json:"hidden,omitempty"`

bootstrap.sh

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -38,20 +38,7 @@ fi
3838

3939
go mod download
4040

41-
GO_VERSION=`go version | { read _ _ v _; echo ${v#go}; }`
42-
GO_TARGET_VERSION=1.17
43-
44-
function version { echo "$@" | awk -F. '{ printf("%d%03d%03d%03d\n", $1,$2,$3,$4); }'; }
45-
46-
if [ $(version $GO_VERSION) -ge $(version $GO_TARGET_VERSION) ];
47-
then
48-
go install github.com/twitchtv/twirp/[email protected]
49-
go install google.golang.org/protobuf/cmd/[email protected]
50-
go install google.golang.org/grpc/cmd/[email protected]
51-
go install github.com/livekit/psrpc/[email protected]
52-
else
53-
go get -u github.com/twitchtv/twirp/[email protected]
54-
go get -u google.golang.org/protobuf/cmd/[email protected]
55-
go get -u google.golang.org/grpc/cmd/[email protected]
56-
go get -u github.com/livekit/psrpc/[email protected]
57-
fi
41+
go install github.com/twitchtv/twirp/[email protected]
42+
go install google.golang.org/protobuf/cmd/[email protected]
43+
go install google.golang.org/grpc/cmd/[email protected]
44+
go install github.com/livekit/psrpc/[email protected]

livekit_models.proto

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,31 @@ message Room {
3434
uint32 num_publishers = 11;
3535
bool active_recording = 10;
3636
PlayoutDelay playout_delay = 12;
37+
AppMode app_mode = 13;
3738

38-
// NEXT-ID: 13
39+
// NEXT-ID: 14
40+
}
41+
42+
// AppMode configures the behavior and limits of the room
43+
enum AppMode {
44+
// default mode, up to 3k users per room, everyone can be a publisher
45+
// most applications should use this mode
46+
AM_DEFAULT = 0;
47+
// Interactive livestreams with support for large audiences
48+
// limited to 25 publishers (with canPublish permissions) and unlimited viewers (with Cloud)
49+
// some behavioral differences in livestream mode:
50+
// - only admins will receive participant information from subscribers
51+
// - default playout_delay is set to 150ms, you can override this by setting playout_delay in CreateRoom
52+
AM_LIVESTREAM = 1;
3953
}
4054

4155
message Codec {
4256
string mime = 1;
4357
string fmtp_line = 2;
4458
}
4559

60+
// AudioCodec and VideoCodec are used by Ingress / Egress
61+
4662
enum AudioCodec {
4763
DEFAULT_AC = 0;
4864
OPUS = 1;

livekit_room.proto

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,15 @@ message CreateRoomRequest {
7474
string metadata = 5;
7575
// egress
7676
RoomEgress egress = 6;
77-
// minimum playout delay of subscriber
77+
// minimum playout delay when receiving remote media
78+
// this is used to smooth out network jitters, and reduces freezes/stutters when a user's network experiences blips
7879
uint32 min_playout_delay = 7;
80+
81+
optional AppMode app_mode = 8;
82+
83+
repeated Codec enabled_codecs = 9;
84+
85+
// NEXT_ID: 10
7986
}
8087

8188
message RoomEgress {

0 commit comments

Comments
 (0)