client: add Start2; deprecate Start (#801)

This commit is contained in:
Alessandro Ros
2025-07-05 13:02:45 +02:00
committed by GitHub
parent 616fa7ea89
commit 9c1011567a
32 changed files with 278 additions and 144 deletions

View File

@@ -18,8 +18,16 @@ import (
// 2. connect to a RTSP server and read all medias on a path.
func main() {
// parse URL
u, err := base.ParseURL("rtsp://myuser:mypass@localhost:8554/mystream")
if err != nil {
panic(err)
}
// Client allows to set additional client options
c := &gortsplib.Client{
c := gortsplib.Client{
Scheme: u.Scheme,
Host: u.Host,
// transport protocol (UDP, Multicast or TCP). If nil, it is chosen automatically
Transport: nil,
// timeout of read operations
@@ -28,14 +36,8 @@ func main() {
WriteTimeout: 10 * time.Second,
}
// parse URL
u, err := base.ParseURL("rtsp://myuser:mypass@localhost:8554/mystream")
if err != nil {
panic(err)
}
// connect to the server
err = c.Start(u.Scheme, u.Host)
err = c.Start2()
if err != nil {
panic(err)
}