Skip to content

Commit

Permalink
add participant egress (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
frostbyte73 authored Sep 18, 2023
1 parent c3acab8 commit 495c2cb
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 29 deletions.
71 changes: 50 additions & 21 deletions cmd/livekit-cli/egress.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,43 +54,57 @@ var (
),
},
{
Name: "start-track-composite-egress",
Usage: "Start track composite egress",
Name: "start-web-egress",
Usage: "Start web egress",
Before: createEgressClient,
Action: startTrackCompositeEgress,
Action: startWebEgress,
Category: egressCategory,
Flags: withDefaultFlags(
&cli.StringFlag{
Name: "request",
Usage: "TrackCompositeEgressRequest as json file (see livekit-cli/examples)",
Usage: "WebEgressRequest as json file (see livekit-cli/examples)",
Required: true,
},
),
},
{
Name: "start-track-egress",
Usage: "Start track egress",
Name: "start-participant-egress",
Usage: "Start participant egress",
Before: createEgressClient,
Action: startTrackEgress,
Action: startParticipantEgress,
Category: egressCategory,
Flags: withDefaultFlags(
&cli.StringFlag{
Name: "request",
Usage: "TrackEgressRequest as json file (see livekit-cli/examples)",
Usage: "ParticipantEgressRequest as json file (see livekit-cli/examples)",
Required: true,
},
),
},
{
Name: "start-web-egress",
Usage: "Start web egress",
Name: "start-track-composite-egress",
Usage: "Start track composite egress",
Before: createEgressClient,
Action: startWebEgress,
Action: startTrackCompositeEgress,
Category: egressCategory,
Flags: withDefaultFlags(
&cli.StringFlag{
Name: "request",
Usage: "WebEgressRequest as json file (see livekit-cli/examples)",
Usage: "TrackCompositeEgressRequest as json file (see livekit-cli/examples)",
Required: true,
},
),
},
{
Name: "start-track-egress",
Usage: "Start track egress",
Before: createEgressClient,
Action: startTrackEgress,
Category: egressCategory,
Flags: withDefaultFlags(
&cli.StringFlag{
Name: "request",
Usage: "TrackEgressRequest as json file (see livekit-cli/examples)",
Required: true,
},
),
Expand Down Expand Up @@ -237,13 +251,13 @@ func startRoomCompositeEgress(c *cli.Context) error {
return nil
}

func startTrackCompositeEgress(c *cli.Context) error {
req := &livekit.TrackCompositeEgressRequest{}
func startWebEgress(c *cli.Context) error {
req := &livekit.WebEgressRequest{}
if err := unmarshalEgressRequest(c, req); err != nil {
return err
}

info, err := egressClient.StartTrackCompositeEgress(context.Background(), req)
info, err := egressClient.StartWebEgress(context.Background(), req)
if err != nil {
return err
}
Expand All @@ -252,13 +266,13 @@ func startTrackCompositeEgress(c *cli.Context) error {
return nil
}

func startTrackEgress(c *cli.Context) error {
req := &livekit.TrackEgressRequest{}
func startParticipantEgress(c *cli.Context) error {
req := &livekit.ParticipantEgressRequest{}
if err := unmarshalEgressRequest(c, req); err != nil {
return err
}

info, err := egressClient.StartTrackEgress(context.Background(), req)
info, err := egressClient.StartParticipantEgress(context.Background(), req)
if err != nil {
return err
}
Expand All @@ -267,13 +281,28 @@ func startTrackEgress(c *cli.Context) error {
return nil
}

func startWebEgress(c *cli.Context) error {
req := &livekit.WebEgressRequest{}
func startTrackCompositeEgress(c *cli.Context) error {
req := &livekit.TrackCompositeEgressRequest{}
if err := unmarshalEgressRequest(c, req); err != nil {
return err
}

info, err := egressClient.StartWebEgress(context.Background(), req)
info, err := egressClient.StartTrackCompositeEgress(context.Background(), req)
if err != nil {
return err
}

printInfo(info)
return nil
}

func startTrackEgress(c *cli.Context) error {
req := &livekit.TrackEgressRequest{}
if err := unmarshalEgressRequest(c, req); err != nil {
return err
}

info, err := egressClient.StartTrackEgress(context.Background(), req)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ require (
github.com/ggwhite/go-masker v1.0.9
github.com/go-logr/logr v1.2.4
github.com/livekit/protocol v1.7.2
github.com/livekit/server-sdk-go v1.0.17-0.20230909175755-a30cb3fe73ff
github.com/livekit/server-sdk-go v1.0.17-0.20230918212012-3a26309be9c5
github.com/manifoldco/promptui v0.9.0
github.com/olekukonko/tablewriter v0.0.5
github.com/pion/rtp v1.8.1
github.com/pion/webrtc/v3 v3.2.19
github.com/pion/webrtc/v3 v3.2.20
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
github.com/pkg/errors v0.9.1
github.com/stretchr/testify v1.8.4
Expand Down
10 changes: 4 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,8 @@ github.com/livekit/protocol v1.7.2 h1:TPk8rIv5ZZSx1IU5jaGA2W+RdoDlE8dp4CFHE0MKoG
github.com/livekit/protocol v1.7.2/go.mod h1:zbh0QPUcLGOeZeIO/VeigwWWbudz4Lv+Px94FnVfQH0=
github.com/livekit/psrpc v0.3.3 h1:+lltbuN39IdaynXhLLxRShgYqYsRMWeeXKzv60oqyWo=
github.com/livekit/psrpc v0.3.3/go.mod h1:n6JntEg+zT6Ji8InoyTpV7wusPNwGqqtxmHlkNhDN0U=
github.com/livekit/server-sdk-go v1.0.16 h1:o3lCl3ZR+aegPDaf8/0WNhAaGApGnh7waoUXdS1Rr4o=
github.com/livekit/server-sdk-go v1.0.16/go.mod h1:lLDZe/p7v4xaVTRMAXXDFWg3PQwGKZQ3hCcLYbVD27k=
github.com/livekit/server-sdk-go v1.0.17-0.20230909175755-a30cb3fe73ff h1:vf+1Bz+VRdM25tj1jr2ddlK2xCVvOvcrjLh3Ahz0CYA=
github.com/livekit/server-sdk-go v1.0.17-0.20230909175755-a30cb3fe73ff/go.mod h1:lLDZe/p7v4xaVTRMAXXDFWg3PQwGKZQ3hCcLYbVD27k=
github.com/livekit/server-sdk-go v1.0.17-0.20230918212012-3a26309be9c5 h1:JZttHKxyzGFuMpsl3Mmt84WU+DZsZg00FCOPfr6CmBY=
github.com/livekit/server-sdk-go v1.0.17-0.20230918212012-3a26309be9c5/go.mod h1:hx8+3zlGcKAmQFUOnmHA1kY4mi67W8L0dp/OrNGt3mc=
github.com/mackerelio/go-osstat v0.2.4 h1:qxGbdPkFo65PXOb/F/nhDKpF2nGmGaCFDLXoZjJTtUs=
github.com/mackerelio/go-osstat v0.2.4/go.mod h1:Zy+qzGdZs3A9cuIqmgbJvwbmLQH9dJvtio5ZjJTbdlQ=
github.com/magefile/mage v1.15.0 h1:BvGheCMAsG3bWUDbZ8AyXXpCNwU9u5CB6sM+HNb9HYg=
Expand Down Expand Up @@ -159,8 +157,8 @@ github.com/pion/transport/v3 v3.0.1 h1:gDTlPJwROfSfz6QfSi0ZmeCSkFcnWWiiR9ES0ouAN
github.com/pion/transport/v3 v3.0.1/go.mod h1:UY7kiITrlMv7/IKgd5eTUcaahZx5oUN3l9SzK5f5xE0=
github.com/pion/turn/v2 v2.1.3 h1:pYxTVWG2gpC97opdRc5IGsQ1lJ9O/IlNhkzj7MMrGAA=
github.com/pion/turn/v2 v2.1.3/go.mod h1:huEpByKKHix2/b9kmTAM3YoX6MKP+/D//0ClgUYR2fY=
github.com/pion/webrtc/v3 v3.2.19 h1:XNu5e62mkzafw1qYuKtQ+Dviw4JpbzC/SLx3zZt49JY=
github.com/pion/webrtc/v3 v3.2.19/go.mod h1:vVURQTBOG5BpWKOJz3nlr23NfTDeyKVmubRNqzQp+Tg=
github.com/pion/webrtc/v3 v3.2.20 h1:BQJiXQsJq9LgLp3op7rLy1y8d2WD+LtiS9cpY0uQ22A=
github.com/pion/webrtc/v3 v3.2.20/go.mod h1:vVURQTBOG5BpWKOJz3nlr23NfTDeyKVmubRNqzQp+Tg=
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 h1:KoWmjvw+nsYOo29YJK9vDA65RGE3NrOnUtO7a+RF9HU=
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8/go.mod h1:HKlIX3XHQyzLZPlr7++PzdhaXEj94dEiJgZDTsxEqUI=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand Down

0 comments on commit 495c2cb

Please sign in to comment.