mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 15:16:51 +08:00
move examples in dedicated folders to follow conventions
This commit is contained in:
37
examples/client-query/main.go
Normal file
37
examples/client-query/main.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/aler9/gortsplib"
|
||||
"github.com/aler9/gortsplib/pkg/base"
|
||||
)
|
||||
|
||||
// This example shows how to
|
||||
// 1. connect to a RTSP server
|
||||
// 2. get and print informations about tracks published on a path.
|
||||
|
||||
func main() {
|
||||
u, err := base.ParseURL("rtsp://myserver/mypath")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
conn, err := gortsplib.Dial(u.Scheme, u.Host)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
defer conn.Close()
|
||||
|
||||
_, err = conn.Options(u)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
tracks, _, err := conn.Describe(u)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
fmt.Println("available tracks: %v\n", tracks)
|
||||
}
|
Reference in New Issue
Block a user