mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 07:06:58 +08:00
client: remove StartReading, StartReadingAndWait
This commit is contained in:
@@ -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)
|
||||
|
Reference in New Issue
Block a user