improve example comments

This commit is contained in:
aler9
2021-04-04 19:43:48 +02:00
parent fc3d84be56
commit c2d5ced43b
8 changed files with 15 additions and 12 deletions

View File

@@ -35,8 +35,8 @@ func main() {
panic(err)
}
// start reading only video tracks, skipping audio or application tracks
for _, t := range tracks {
// start reading only video tracks, skipping audio or application tracks
if t.Media.MediaName.Media == "video" {
_, err := conn.Setup(headers.TransportModePlay, t, 0, 0)
if err != nil {
@@ -45,12 +45,13 @@ func main() {
}
}
// play setupped tracks
_, err = conn.Play()
if err != nil {
panic(err)
}
// read track frames
// read RTP frames
err = <-conn.ReadFrames(func(trackID int, typ gortsplib.StreamType, buf []byte) {
fmt.Printf("frame from track %d, type %v, size %d\n", trackID, typ, len(buf))
})