streaming

Media streaming and broadcast systems in Go
Log | Files | Refs | README | LICENSE

commit a5dbf39878dda31b7eb1688c39bd9c81b074e1b1
parent 8e53152fcfe39faafa76242ad58909c35ff29015
Author: Oliver Lowe <o@olowe.co>
Date:   Thu, 18 Jul 2024 20:39:51 +1000

sdp: add simplest example usage of the package

The only yucky thing here is we do not follow our own recommendation
to use sdp.Now(); it's non-deterministic so can't be set in the
examples "Output:" comment. But good enough for a first go!

Diffstat:
Asdp/example_test.go | 29+++++++++++++++++++++++++++++
1 file changed, 29 insertions(+), 0 deletions(-)

diff --git a/sdp/example_test.go b/sdp/example_test.go @@ -0,0 +1,29 @@ +package sdp_test + +import ( + "fmt" + + "github.com/untangledco/streaming/sdp" +) + +// The simplest Session may be described by setting the mandatory fields Origin and Name. +// The Session type implements fmt.Stringer. +// To encode a Session in the SDP text format, use Session.String(). +func Example() { + session := sdp.Session{ + Origin: sdp.Origin{ + Username: sdp.NoUsername, + ID: 3930287268, // example only; use sdp.Now() + Version: 3930287268, // example only; use sdp.Now() + AddressType: "IP6", // or "IP4" + Address: "2001:db8::1", + }, + Name: "A call from me to you", + } + fmt.Printf("%s", session) + // Output: + // v=0 + // o=- 3930287268 3930287268 IN IP6 2001:db8::1 + // s=A call from me to you + // t=0 0 +}