Skip to content

Commit

Permalink
add/remove audio renderer for local tracks
Browse files Browse the repository at this point in the history
  • Loading branch information
hiroshihorie committed Sep 21, 2024
1 parent 471a1b3 commit ae0b528
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Sources/LiveKit/Track/AudioTrack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
10 changes: 10 additions & 0 deletions Sources/LiveKit/Track/Local/LocalAudioTrack.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

0 comments on commit ae0b528

Please sign in to comment.