Playback (Streaming)

Remote playback control and stream delivery to the main destination

This example demonstrates how to receive and play audio from a remote source. A connection is established with a network stream in MP3 format and routed directly to the main output destination. This flow demonstrates the ability to process network audio with low latency.

// Configure the graph for rendering
let context = Assembler(rendering: .live).createAudioGraph()

// Configure an audio source (Renderer) from a remote resource
let url = URL(string: "http://example.com/stream.mp3")!
let source = MediaRadioRenderer(contentsOf: url, channels: .stereo)

// Configure node connections
try context.connect(source: source, to: context.destination)
source.play(after: 0)

The following video shows the sample code in action and its real-time processing.

circle-info

For a complete description of each class, method, and property referenced in this section, refer to the official API documentationarrow-up-right, where you will find detailed references, available components, parameters, and additional usage code examples.

Last updated