Skip to main content

Bridge audio sink and source

Bridges can be used to connect different media pipelines and use them independently. BridgeAudioSourceBlock is used to connect to BridgeAudioSinkBlock and supports uncompressed audio.

Block info

BridgeAudioSourceBlock information

Pin directionMedia typePins count
Output audiouncompressed audio1

BridgeAudioSinkBlock information

Pin directionMedia typePins count
Input audiouncompressed audio1

Sample pipelines

First pipeline with an audio source and a bridge audio sink

Second pipeline with a bridge audio source and an audio renderer

Sample code

The source pipeline with virtual audio source and bridge audio sink.

// create source pipeline
var sourcePipeline = new MediaBlocksPipeline();

// create virtual audio source and bridge audio sink
var audioSourceBlock = new VirtualAudioSourceBlock(new VirtualAudioSourceSettings());
var bridgeAudioSink = new BridgeAudioSinkBlock(new BridgeAudioSinkSettings());

// connect source and sink
sourcePipeline.Connect(audioSourceBlock.Output, bridgeAudioSink.Input);

// start pipeline
await sourcePipeline.StartAsync();

The sink pipeline with bridge audio source and audio renderer.

// create sink pipeline
var sinkPipeline = new MediaBlocksPipeline();

// create bridge audio source and audio renderer
var bridgeAudioSource = new BridgeAudioSourceBlock(new BridgeAudioSourceSettings());
var audioRenderer = new AudioRendererBlock();

// connect source and sink
sinkPipeline.Connect(bridgeAudioSource.Output, audioRenderer.Input);

// start pipeline
await sinkPipeline.StartAsync();

Platforms

Windows, macOS, Linux, iOS, Android.