Documentation
¶
Overview ¶
Example (Pipewire) ¶
package main import ( "context" "log" "net" "time" "xengineering.eu/soundbox-go/soundbox" ) func main() { ctx, cancel := context.WithCancel(context.Background()) // all soundboxes are referenced by their MAC address soundboxes := []net.HardwareAddr{ {0x00, 0x00, 0x5E, 0x00, 0x53, 0x01}, {0x00, 0x00, 0x5E, 0x00, 0x53, 0x02}, {0x00, 0x00, 0x5E, 0x00, 0x53, 0x03}, } // start streaming go func() { err := soundbox.StreamPipewireContext(ctx, soundboxes) if err != nil { log.Fatal(err) } }() // let it play for some time time.Sleep(time.Minute) // stop it cancel() }
Output:
Example (Url) ¶
package main import ( "context" "log" "net" "time" "xengineering.eu/soundbox-go/soundbox" ) func main() { ctx, cancel := context.WithCancel(context.Background()) // all soundboxes are referenced by their MAC address soundboxes := []net.HardwareAddr{ {0x00, 0x00, 0x5E, 0x00, 0x53, 0x01}, {0x00, 0x00, 0x5E, 0x00, 0x53, 0x02}, {0x00, 0x00, 0x5E, 0x00, 0x53, 0x03}, } // currently only web radio is supported url := "https://example.org/radio.mp3" // start streaming go func() { err := soundbox.StreamURLContext(ctx, url, soundboxes) if err != nil { log.Fatal(err) } }() // let it play for some time time.Sleep(time.Minute) // stop it cancel() }
Output:
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func StreamPipewireContext ¶ added in v0.2.0
func StreamPipewireContext(ctx context.Context, targets []net.HardwareAddr) error
func StreamURLContext ¶
StreamURLContext streams audio from a given URL to one or multiple soundbox devices. The devices are referenced via their MAC addresses given by the targets argument. The ctx argument is passed to cancel the streaming.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.