binding to buffer and correctly forwarding

This commit is contained in:
David Zhao
2021-01-10 16:18:58 -08:00
parent 258f5add2d
commit 7dcb88343a
18 changed files with 751 additions and 338 deletions
+8 -5
View File
@@ -112,11 +112,14 @@ func joinRoom(c *cli.Context) error {
// add tracks if needed
audioFile := c.String("audio")
videoFile := c.String("video")
if audioFile != "" {
rc.AddTrack(audioFile, "audio", filepath.Base(audioFile))
}
if videoFile != "" {
rc.AddTrack(videoFile, "video", filepath.Base(videoFile))
rc.OnConnected = func() {
// add after connection, since we need proper publish track APIs
if audioFile != "" {
rc.AddTrack(audioFile, "audio", filepath.Base(audioFile))
}
if videoFile != "" {
rc.AddTrack(videoFile, "video", filepath.Base(videoFile))
}
}
// start loop to detect input
+1
View File
@@ -35,6 +35,7 @@ var (
Aliases: []string{"r"},
Usage: "name of the room to join, empty to allow joining all rooms",
},
devFlag,
},
},
}
+11 -2
View File
@@ -36,6 +36,10 @@ var (
EnvVars: []string{"LK_API_SECRET"},
Required: true,
}
devFlag = &cli.BoolFlag{
Name: "dev",
Usage: "enables dev mode, longer expiration for tokens",
}
)
func PrintJSON(obj interface{}) {
@@ -60,9 +64,14 @@ func accessToken(c *cli.Context, grant *auth.VideoGrant, identity string) (value
return
}
isDev := c.Bool("dev")
at := auth.NewAccessToken(apiKey, apiSecret).
AddGrant(grant).
SetIdentity(identity).
SetValidFor(time.Hour * 24)
SetIdentity(identity)
if isDev {
fmt.Println("creating dev token")
at.SetValidFor(time.Hour * 24 * 30)
}
return at.ToJWT()
}