mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 07:06:58 +08:00
improve examples
This commit is contained in:
@@ -38,13 +38,13 @@ func main() {
|
||||
log.Println("stream connected")
|
||||
|
||||
// create a media that contains a H264 media
|
||||
medias := media.Medias{&media.Media{
|
||||
medi := &media.Media{
|
||||
Type: media.TypeVideo,
|
||||
Formats: []format.Format{&format.H264{
|
||||
PayloadTyp: 96,
|
||||
PacketizationMode: 1,
|
||||
}},
|
||||
}}
|
||||
}
|
||||
|
||||
// Client allows to set additional client options
|
||||
c := &gortsplib.Client{
|
||||
@@ -57,7 +57,7 @@ func main() {
|
||||
}
|
||||
|
||||
// connect to the server and start recording the media
|
||||
err = c.StartRecording("rtsp://localhost:8554/mystream", medias)
|
||||
err = c.StartRecording("rtsp://localhost:8554/mystream", media.Medias{medi})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -72,7 +72,7 @@ func main() {
|
||||
}
|
||||
|
||||
// route RTP packet to the server
|
||||
err = c.WritePacketRTP(medias[0], &pkt)
|
||||
err = c.WritePacketRTP(medi, &pkt)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user