client: remove StartReading, StartReadingAndWait

This commit is contained in:
aler9
2022-07-09 17:08:37 +02:00
parent 36c6d0b7ef
commit e262385062
11 changed files with 140 additions and 75 deletions

View File

@@ -4,6 +4,7 @@ import (
"log"
"github.com/aler9/gortsplib"
"github.com/aler9/gortsplib/pkg/url"
)
// This example shows how to connect to a RTSP server
@@ -21,6 +22,31 @@ func main() {
},
}
// connect to the server and start reading all tracks
panic(c.StartReadingAndWait("rtsp://localhost:8554/mystream"))
// parse URL
u, err := url.Parse("rtsp://localhost:8554/mystream")
if err != nil {
panic(err)
}
// connect to the server
err = c.Start(u.Scheme, u.Host)
if err != nil {
panic(err)
}
defer c.Close()
// find published tracks
tracks, baseURL, _, err := c.Describe(u)
if err != nil {
panic(err)
}
// setup and read all tracks
err = c.SetupAndPlay(tracks, baseURL)
if err != nil {
panic(err)
}
// wait until a fatal error
panic(c.Wait())
}