Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
pidan
/
FuSiLive
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
4c2c58f2
authored
Jan 17, 2025
by
pierce
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复连麦声音问题
parent
5df38f0e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
21 deletions
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/View/FunctionView/LinkMicro/Other/FUSAgoraHelper.m
Modules/FUSShowRoomModule/FUSShowRoomModule/Features/NewLive/Main/View/FunctionView/LinkMicro/Other/FUSAgoraHelper.m
View file @
4c2c58f2
...
...
@@ -577,30 +577,32 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
-
(
void
)
delayUpdateToSpeakerPlay
{
AVAudioSessionCategoryOptions
currentCategoryOptions
=
[
AVAudioSession
sharedInstance
].
categoryOptions
;
[
self
.
agoraEngine
setEnableSpeakerphone
:
YES
];
currentCategoryOptions
=
[
AVAudioSession
sharedInstance
].
categoryOptions
;
AVAudioSessionCategory
currentCategory
=
[
AVAudioSession
sharedInstance
].
category
;
AVAudioSessionCategoryOptions
categoryOptions
=
AVAudioSessionCategoryOptionMixWithOthers
|
AVAudioSessionCategoryOptionAllowBluetooth
|
AVAudioSessionCategoryOptionDefaultToSpeaker
|
AVAudioSessionCategoryOptionAllowBluetoothA2DP
;
NSError
*
error
;
[[
AVAudioSession
sharedInstance
]
setCategory
:
AVAudioSessionCategoryPlayAndRecord
withOptions
:
categoryOptions
error
:&
error
];
AVAudioSessionRouteDescription
*
currentRoute
=
[
AVAudioSession
sharedInstance
].
currentRoute
;
BOOL
needForceToSpeaker
=
NO
;
for
(
AVAudioSessionPortDescription
*
port
in
currentRoute
.
outputs
)
{
/// 连麦不通过听筒播放
if
(
port
.
portType
==
AVAudioSessionPortBuiltInReceiver
)
{
needForceToSpeaker
=
YES
;
dispatch_async
(
dispatch_get_global_queue
(
0
,
0
),
^
{
AVAudioSessionCategoryOptions
currentCategoryOptions
=
[
AVAudioSession
sharedInstance
].
categoryOptions
;
[
self
->
_agoraEngine
setEnableSpeakerphone
:
YES
];
AVAudioSessionCategoryOptions
categoryOptions
=
43
;
NSError
*
error
;
if
(
currentCategoryOptions
<
categoryOptions
)
{
[[
AVAudioSession
sharedInstance
]
setCategory
:
AVAudioSessionCategoryPlayAndRecord
withOptions
:
categoryOptions
error
:&
error
];
}
}
if
(
needForceToSpeaker
)
{
[[
AVAudioSession
sharedInstance
]
overrideOutputAudioPort
:
AVAudioSessionPortOverrideSpeaker
error
:
nil
];
}
[[
AVAudioSession
sharedInstance
]
setActive
:
YES
error
:
nil
];
currentCategoryOptions
=
[
AVAudioSession
sharedInstance
].
categoryOptions
;
AVAudioSessionRouteDescription
*
currentRoute
=
[
AVAudioSession
sharedInstance
].
currentRoute
;
BOOL
needForceToSpeaker
=
NO
;
for
(
AVAudioSessionPortDescription
*
port
in
currentRoute
.
outputs
)
{
/// 连麦不通过听筒播放
if
(
port
.
portType
==
AVAudioSessionPortBuiltInReceiver
)
{
needForceToSpeaker
=
YES
;
}
}
if
(
needForceToSpeaker
)
{
[[
AVAudioSession
sharedInstance
]
overrideOutputAudioPort
:
AVAudioSessionPortOverrideSpeaker
error
:
nil
];
}
[[
AVAudioSession
sharedInstance
]
setActive
:
YES
error
:
nil
];
currentCategoryOptions
=
[
AVAudioSession
sharedInstance
].
categoryOptions
;
});
}
#pragma mark - AgoraVideoFrameDelegate
-
(
BOOL
)
onRenderVideoFrame
:
(
AgoraOutputVideoFrame
*
)
videoFrame
uid
:
(
NSUInteger
)
uid
channelId
:
(
NSString
*
)
channelId
{
if
(
uid
==
FUSLiveHelper
.
shareInstance
.
roomInfoModel
.
roomId
.
integerValue
&&
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment