attachToContainerWithAudioTrack

fun attachToContainerWithAudioTrack(currentContext: Context, audioTrack: AudioTrack)

Attaches spatial audio to a Container/Context using an already-created AudioTrack.

When to use: Use this method when the AudioTrack is already created by an external framework and the audio should follow the window/container position in 3D space.

Usage steps:

  1. Configure spatial audio mode via spatialAudioTrackExtensionConfig before creating the AudioTrack.

  2. Create/configure the AudioTrack through your media framework.

  3. Call this method to bind the AudioTrack to the container/window.

Parameters

currentContext

The Context/Container to attach spatial audio to.

audioTrack

The AudioTrack to bind.

Throws

IllegalStateException

if attachment fails.