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

@@ -5,6 +5,7 @@ import (
"time"
"github.com/aler9/gortsplib"
"github.com/aler9/gortsplib/pkg/url"
)
// This example shows how to
@@ -25,13 +26,31 @@ func main() {
},
}
// connect to the server and start reading all tracks
err := c.StartReading("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)
}
for {
// wait
time.Sleep(5 * time.Second)