diff --git a/examples/client-read-options.go b/examples/client-read-options.go index 100aecbe..516b536f 100644 --- a/examples/client-read-options.go +++ b/examples/client-read-options.go @@ -33,11 +33,8 @@ func main() { defer conn.Close() // read track frames - done := conn.ReadFrames(func(id int, typ gortsplib.StreamType, buf []byte) { + err = <-conn.ReadFrames(func(id int, typ gortsplib.StreamType, buf []byte) { fmt.Printf("frame from track %d, type %v: %v\n", id, typ, buf) }) - - // catch any error - err = <-done panic(err) } diff --git a/examples/client-read-partial.go b/examples/client-read-partial.go index 4bbd1a36..9a065f2f 100644 --- a/examples/client-read-partial.go +++ b/examples/client-read-partial.go @@ -53,11 +53,8 @@ func main() { } // read track frames - done := conn.ReadFrames(func(id int, typ gortsplib.StreamType, buf []byte) { + err = <-conn.ReadFrames(func(id int, typ gortsplib.StreamType, buf []byte) { fmt.Printf("frame from track %d, type %v: %v\n", id, typ, buf) }) - - // catch any error - err = <-done panic(err) } diff --git a/examples/client-read.go b/examples/client-read.go index c72f819e..39d537a6 100644 --- a/examples/client-read.go +++ b/examples/client-read.go @@ -21,11 +21,8 @@ func main() { defer conn.Close() // read track frames - done := conn.ReadFrames(func(id int, typ gortsplib.StreamType, buf []byte) { + err = <-conn.ReadFrames(func(id int, typ gortsplib.StreamType, buf []byte) { fmt.Printf("frame from track %d, type %v: %v\n", id, typ, buf) }) - - // catch any error - err = <-done panic(err) }