mirror of
https://github.com/aler9/gortsplib
synced 2025-10-12 18:40:07 +08:00
improve examples
This commit is contained in:
@@ -37,7 +37,7 @@ func main() {
|
||||
log.Println("stream connected")
|
||||
|
||||
// create a media that contains a MPEG4-audio format
|
||||
medias := media.Medias{&media.Media{
|
||||
medi := &media.Media{
|
||||
Type: media.TypeAudio,
|
||||
Formats: []format.Format{&format.MPEG4Audio{
|
||||
PayloadTyp: 96,
|
||||
@@ -50,11 +50,11 @@ func main() {
|
||||
IndexLength: 3,
|
||||
IndexDeltaLength: 3,
|
||||
}},
|
||||
}}
|
||||
}
|
||||
|
||||
// connect to the server and start recording the media
|
||||
c := gortsplib.Client{}
|
||||
err = c.StartRecording("rtsp://localhost:8554/mystream", medias)
|
||||
err = c.StartRecording("rtsp://localhost:8554/mystream", media.Medias{medi})
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -69,7 +69,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