ActiveRecording (#234)

* ActiveRecording

* regenerate

* update to 0.10.3

* 1.17
This commit is contained in:
David Colburn
2021-12-03 21:40:53 -08:00
committed by GitHub
parent c00d799ac6
commit c41384cd09
14 changed files with 136 additions and 33 deletions
+11 -8
View File
@@ -3,7 +3,6 @@ package service
import (
"context"
"errors"
"time"
"github.com/livekit/protocol/logger"
livekit "github.com/livekit/protocol/proto"
@@ -63,8 +62,15 @@ func (s *RecordingService) StartRecording(ctx context.Context, req *livekit.Star
return nil, err
}
ri := &livekit.RecordingInfo{
Id: recordingId,
Active: true,
}
if template := req.Input.(*livekit.StartRecordingRequest_Template); template != nil {
ri.RoomName = template.Template.RoomName
}
logger.Debugw("recording started", "recordingID", recordingId)
s.telemetry.RecordingStarted(ctx, recordingId, req)
s.telemetry.RecordingStarted(ctx, ri)
return &livekit.StartRecordingResponse{RecordingId: recordingId}, nil
}
@@ -85,6 +91,7 @@ func (s *RecordingService) AddOutput(ctx context.Context, req *livekit.AddOutput
if err != nil {
return nil, err
}
return &emptypb.Empty{}, nil
}
@@ -104,6 +111,7 @@ func (s *RecordingService) RemoveOutput(ctx context.Context, req *livekit.Remove
if err != nil {
return nil, err
}
return &emptypb.Empty{}, nil
}
@@ -140,7 +148,7 @@ func (s *RecordingService) resultsWorker() {
case msg := <-resChan:
b := sub.Payload(msg)
res := &livekit.RecordingResult{}
res := &livekit.RecordingInfo{}
if err = proto.Unmarshal(b, res); err != nil {
logger.Errorw("failed to read results", err)
continue
@@ -150,11 +158,6 @@ func (s *RecordingService) resultsWorker() {
values := []interface{}{"recordingID", res.Id}
if res.Error != "" {
values = append(values, "error", res.Error)
} else {
values = append(values, "duration", time.Duration(res.Duration*1e9))
if res.DownloadUrl != "" {
values = append(values, "url", res.DownloadUrl)
}
}
logger.Debugw("recording ended", values...)
+1
View File
@@ -91,6 +91,7 @@ func (s *RTCService) validate(r *http.Request) (string, routing.ParticipantInit,
AutoSubscribe: true,
Metadata: claims.Metadata,
Hidden: claims.Video.Hidden,
Recorder: claims.Video.Recorder,
Client: s.parseClientInfo(r.Form),
}
if autoSubParam != "" {
+1 -2
View File
@@ -1,8 +1,7 @@
// Code generated by Wire. DO NOT EDIT.
//go:generate go run github.com/google/wire/cmd/wire
//go:build !wireinject
// +build !wireinject
//+build !wireinject
package service