add client-read-pause example

This commit is contained in:
aler9
2020-11-19 11:20:23 +01:00
parent ca060556b0
commit 8a8a8d9b5a
7 changed files with 80 additions and 14 deletions

View File

@@ -8,8 +8,9 @@ import (
"github.com/aler9/gortsplib"
)
// This example shows how to create a RTSP client, connect to a server and
// read all tracks with the TCP protocol.
// This example shows how to
// * connect to a RTSP server
// * read all tracks with the TCP protocol
func main() {
// connect to the server and start reading all tracks
@@ -23,7 +24,6 @@ func main() {
defer conn.Close()
readerDone := make(chan struct{})
defer func() { <-readerDone }()
// read frames from the server
conn.OnFrame(func(id int, typ gortsplib.StreamType, buf []byte, err error) {
@@ -35,4 +35,6 @@ func main() {
fmt.Printf("frame from track %d, type %v: %v\n", id, typ, buf)
})
<-readerDone
}