fix: revert to actual trackID for audioMix (kCMPersistentTrackID_Invalid never fires tap)

This commit is contained in:
yumoqing 2026-06-27 17:59:45 +08:00
parent 7cfeec1f15
commit 70b264bcc8

View File

@ -356,17 +356,18 @@ final class PlayerRecorder: NSObject {
return return
} }
// AudioMix kCMPersistentTrackID_Invalid // AudioMix trackID
// HLS variant audio track ID ID tap // kCMPersistentTrackID_Invalid (=0) tap
let inputParams = AVMutableAudioMixInputParameters() let inputParams = AVMutableAudioMixInputParameters()
inputParams.trackID = kCMPersistentTrackID_Invalid inputParams.trackID = audioTrack.trackID
inputParams.audioTapProcessor = tapRef inputParams.audioTapProcessor = tapRef
let audioMix = AVMutableAudioMix() let audioMix = AVMutableAudioMix()
audioMix.inputParameters = [inputParams] audioMix.inputParameters = [inputParams]
playerItem.audioMix = audioMix playerItem.audioMix = audioMix
NSLog("[Recorder] ✓ Audio tap installed on playerItem, trackID=%d", audioTrack.trackID) NSLog("[Recorder] ✓ Audio tap installed: trackID=%d, asset tracks=%d, playerItem.audioMix set",
audioTrack.trackID, playerItem.asset.tracks.count)
} }
// MARK: - // MARK: -