Skip to content

Commit

Permalink
fix #698
Browse files Browse the repository at this point in the history
  • Loading branch information
kingslay committed Dec 22, 2023
1 parent 1a2396c commit 474dfc5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/KSPlayer/AVPlayer/KSOptions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -509,13 +509,17 @@ public extension KSOptions {
var channelCount = channelCount
if channelCount > 2 {
let minChannels = min(maximumOutputNumberOfChannels, channelCount)
// iOS 有空间音频功能,所以不用处理
#if os(tvOS) || targetEnvironment(simulator)
if !(isUseAudioRenderer && isSpatialAudioEnabled) {
// 不要用maxRouteChannelsCount来判断,有可能会不准。导致多音道设备也返回2(一开始播放一个2声道,就容易出现),也不能用outputNumberOfChannels来判断,有可能会返回2
// channelCount = AVAudioChannelCount(min(AVAudioSession.sharedInstance().outputNumberOfChannels, maxRouteChannelsCount))
channelCount = minChannels
}
#else
// iOS 外放是会自动有空间音频功能,但是蓝牙耳机有可能没有空间音频功能或者把空间音频给关了,。所以还是需要处理。
if !isSpatialAudioEnabled {
channelCount = minChannels
}
#endif
} else {
channelCount = 2
Expand Down

0 comments on commit 474dfc5

Please sign in to comment.