mirror of
https://github.com/aler9/gortsplib
synced 2025-10-06 07:37:07 +08:00
add client-read-pause example
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user