diff --git a/Sources/LiveKit/Track/AudioTrack.swift b/Sources/LiveKit/Track/AudioTrack.swift index 41417f4cf..003bb09e2 100644 --- a/Sources/LiveKit/Track/AudioTrack.swift +++ b/Sources/LiveKit/Track/AudioTrack.swift @@ -17,4 +17,10 @@ import Foundation @objc -public protocol AudioTrack where Self: Track {} +public protocol AudioTrack where Self: Track { + @objc(addAudioRenderer:) + func add(audioRenderer: AudioRenderer) + + @objc(removeAudioRenderer:) + func remove(audioRenderer: AudioRenderer) +} diff --git a/Sources/LiveKit/Track/Local/LocalAudioTrack.swift b/Sources/LiveKit/Track/Local/LocalAudioTrack.swift index 2255a4501..1f466e806 100644 --- a/Sources/LiveKit/Track/Local/LocalAudioTrack.swift +++ b/Sources/LiveKit/Track/Local/LocalAudioTrack.swift @@ -94,3 +94,13 @@ public extension LocalAudioTrack { var publishOptions: TrackPublishOptions? { super._state.lastPublishOptions } var publishState: Track.PublishState { super._state.publishState } } + +public extension LocalAudioTrack { + func add(audioRenderer: AudioRenderer) { + AudioManager.shared.add(localAudioRenderer: audioRenderer) + } + + func remove(audioRenderer: AudioRenderer) { + AudioManager.shared.remove(localAudioRenderer: audioRenderer) + } +}