binding to buffer and correctly forwarding
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -35,6 +35,7 @@ var (
|
||||
Aliases: []string{"r"},
|
||||
Usage: "name of the room to join, empty to allow joining all rooms",
|
||||
},
|
||||
devFlag,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user