Recording apis (#78)
* apis with auth * recording service * record permission * protocol 0.6.5 * bump version
This commit is contained in:
@@ -7,7 +7,6 @@ import (
|
||||
"github.com/thoas/go-funk"
|
||||
"github.com/twitchtv/twirp"
|
||||
|
||||
"github.com/livekit/livekit-server/pkg/recording"
|
||||
"github.com/livekit/livekit-server/pkg/routing"
|
||||
livekit "github.com/livekit/livekit-server/proto"
|
||||
)
|
||||
@@ -15,15 +14,10 @@ import (
|
||||
// A rooms service that supports a single node
|
||||
type RoomService struct {
|
||||
roomManager *RoomManager
|
||||
recorder *recording.RoomRecorder
|
||||
}
|
||||
|
||||
func NewRoomService(roomManager *RoomManager, rs *recording.RoomRecorder) (svc *RoomService, err error) {
|
||||
svc = &RoomService{
|
||||
roomManager: roomManager,
|
||||
recorder: rs,
|
||||
}
|
||||
|
||||
func NewRoomService(roomManager *RoomManager) (svc *RoomService, err error) {
|
||||
svc = &RoomService{roomManager: roomManager}
|
||||
return
|
||||
}
|
||||
|
||||
@@ -32,31 +26,11 @@ func (s *RoomService) CreateRoom(ctx context.Context, req *livekit.CreateRoomReq
|
||||
return nil, twirpAuthError(err)
|
||||
}
|
||||
|
||||
var recordingID string
|
||||
if req.Recording != nil {
|
||||
if s.recorder == nil {
|
||||
return nil, errors.New("recording not configured (redis required)")
|
||||
}
|
||||
|
||||
recordingID, err = s.recorder.ReserveRecorder(ctx, req.Recording)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "could not reserve recorder")
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
rm, err = s.roomManager.CreateRoom(req)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "could not create room")
|
||||
}
|
||||
|
||||
if recordingID != "" {
|
||||
err = s.recorder.StartRecording(ctx, recordingID)
|
||||
if err != nil {
|
||||
err = errors.Wrap(err, "could not start recording")
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user