forked from bluenviron/gortsplib
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
38 lines (30 loc) · 657 Bytes
/
main.go
File metadata and controls
38 lines (30 loc) · 657 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Package main contains an example.
package main
import (
"log"
"github.com/bluenviron/gortsplib/v5"
"github.com/bluenviron/gortsplib/v5/pkg/base"
)
// This example shows how to:
// 1. connect to a RTSP server.
// 2. get and print informations about medias published on a path.
func main() {
u, err := base.ParseURL("rtsp://myuser:mypass@localhost:8554/mypath")
if err != nil {
panic(err)
}
c := gortsplib.Client{
Scheme: u.Scheme,
Host: u.Host,
}
err = c.Start()
if err != nil {
panic(err)
}
defer c.Close()
desc, _, err := c.Describe(u)
if err != nil {
panic(err)
}
log.Printf("available medias: %v\n", desc.Medias)
}