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
7643ea27
authored
Jul 10, 2024
by
ludi
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/UI修改版本' of
http://git.yabolive.net:88/pidan/FuSiLive
into feature/UI修改版本
parents
b6089def
6964fdbc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
11 deletions
DevelopmentPods/FUSFoundation/FUSFoundation/Classes/FUSFoundation/Views/FUSStyleButton.m
FuSiLive/Classes/NewLive/Main/View/FunctionView/LinkMicro/Other/FUSAgoraHelper.m
DevelopmentPods/FUSFoundation/FUSFoundation/Classes/FUSFoundation/Views/FUSStyleButton.m
View file @
7643ea27
...
@@ -225,7 +225,7 @@
...
@@ -225,7 +225,7 @@
[
self
setTitleColor
:[
UIColor
whiteColor
]
forState
:
UIControlStateDisabled
];
[
self
setTitleColor
:[
UIColor
whiteColor
]
forState
:
UIControlStateDisabled
];
self
.
layer
.
cornerRadius
=
self
.
height
/
2
.
0
f
;
self
.
layer
.
cornerRadius
=
self
.
height
/
2
.
0
f
;
self
.
layer
.
masksToBounds
=
YES
;
self
.
layer
.
masksToBounds
=
YES
;
self
.
backgroundColor
=
[
UIColor
fus_
diamondBlue
];
self
.
backgroundColor
=
[
UIColor
fus_
appMainColor
];
}
}
break
;
break
;
case
FUSButtonStyleBlueBorder
:
case
FUSButtonStyleBlueBorder
:
...
...
FuSiLive/Classes/NewLive/Main/View/FunctionView/LinkMicro/Other/FUSAgoraHelper.m
View file @
7643ea27
...
@@ -107,10 +107,14 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
...
@@ -107,10 +107,14 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
if
(
reason
==
AVAudioSessionRouteChangeReasonCategoryChange
)
{
if
(
reason
==
AVAudioSessionRouteChangeReasonCategoryChange
)
{
AVAudioSessionCategoryOptions
currentCategoryOptions
=
[
AVAudioSession
sharedInstance
].
categoryOptions
;
AVAudioSessionCategoryOptions
currentCategoryOptions
=
[
AVAudioSession
sharedInstance
].
categoryOptions
;
AVAudioSessionCategory
currentCategory
=
[
AVAudioSession
sharedInstance
].
category
;
AVAudioSessionCategory
currentCategory
=
[
AVAudioSession
sharedInstance
].
category
;
//在需要进行对audioSession进行修正的场景下(RTC直播),修改category时options未包含mixWithOther,则给options追加mixWithOther
// //在需要进行对audioSession进行修正的场景下(RTC直播),修改category时options未包含mixWithOther,则给options追加mixWithOther
if
(
!
(
currentCategoryOptions
&
AVAudioSessionCategoryOptionMixWithOthers
))
{
AVAudioSessionCategoryOptions
categoryOptions
=
AVAudioSessionCategoryOptionMixWithOthers
|
AVAudioSessionCategoryOptionAllowBluetooth
|
AVAudioSessionCategoryOptionDefaultToSpeaker
|
AVAudioSessionCategoryOptionAllowBluetoothA2DP
;
[[
AVAudioSession
sharedInstance
]
setCategory
:
currentCategory
withOptions
:
currentCategoryOptions
|
AVAudioSessionCategoryOptionMixWithOthers
error
:
nil
];
if
(
currentCategoryOptions
!=
categoryOptions
)
{
[[
AVAudioSession
sharedInstance
]
setCategory
:
currentCategory
withOptions
:
categoryOptions
error
:
nil
];
}
}
//
[[
AVAudioSession
sharedInstance
]
overrideOutputAudioPort
:
AVAudioSessionPortOverrideSpeaker
error
:
nil
];
[[
AVAudioSession
sharedInstance
]
setActive
:
YES
error
:
nil
];
}
}
}
}
...
@@ -155,7 +159,7 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
...
@@ -155,7 +159,7 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
success
:
(
void
(
^
)(
void
))
success
success
:
(
void
(
^
)(
void
))
success
failure
:
(
void
(
^
)(
void
))
failure
failure
:
(
void
(
^
)(
void
))
failure
{
{
[
[
AVAudioSession
sharedInstance
]
setCategory
:
AVAudioSessionCategoryPlayAndRecord
error
:
nil
];
[
self
delayUpdateToSpeakerPlay
];
_joinChannelSuccessBlock
=
success
;
_joinChannelSuccessBlock
=
success
;
FUSLogVerbose
(
@"连麦:开始加入频道"
);
FUSLogVerbose
(
@"连麦:开始加入频道"
);
_uid
=
uid
;
_uid
=
uid
;
...
@@ -226,7 +230,8 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
...
@@ -226,7 +230,8 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
_myselfIsOnMic
=
YES
;
_myselfIsOnMic
=
YES
;
[[
AVAudioSession
sharedInstance
]
setCategory
:
AVAudioSessionCategoryPlayAndRecord
error
:
nil
];
[
self
delayUpdateToSpeakerPlay
];
FUSLogDebug
(
@"pp===准备进入频道 %@"
,
channelId
);
FUSLogDebug
(
@"pp===准备进入频道 %@"
,
channelId
);
__weak
typeof
(
self
)
weakSelf
=
self
;
__weak
typeof
(
self
)
weakSelf
=
self
;
int
code
=
[
self
.
agoraEngine
joinChannelByToken
:
nil
channelId
:
channelId
info
:
@""
uid
:
uid
joinSuccess
:^
(
NSString
*
_Nonnull
channel
,
NSUInteger
uid
,
NSInteger
elapsed
)
{
int
code
=
[
self
.
agoraEngine
joinChannelByToken
:
nil
channelId
:
channelId
info
:
@""
uid
:
uid
joinSuccess
:^
(
NSString
*
_Nonnull
channel
,
NSUInteger
uid
,
NSInteger
elapsed
)
{
...
@@ -243,10 +248,10 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
...
@@ -243,10 +248,10 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
FUSLogDebug
(
@"pp===准备进入成功 %@"
,
channel
);
FUSLogDebug
(
@"pp===准备进入成功 %@"
,
channel
);
[
self
updateToSpeakerPlay
];
if
(
TEST_CODE
)
{
if
(
TEST_CODE
)
{
[
FUSDialogView
fus_showDialog
:[
NSString
stringWithFormat
:
@"测试:加入频道成功 %@"
,
channel
]];
[
FUSDialogView
fus_showDialog
:[
NSString
stringWithFormat
:
@"测试:加入频道成功 %@"
,
channel
]];
}
}
[[
AVAudioSession
sharedInstance
]
setCategory
:
AVAudioSessionCategoryPlayAndRecord
error
:
nil
];
if
(
success
)
{
if
(
success
)
{
success
();
success
();
...
@@ -392,12 +397,14 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
...
@@ -392,12 +397,14 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
[
_agoraEngine
enableLocalVideo
:
NO
];
[
_agoraEngine
enableLocalVideo
:
NO
];
}
}
[
_agoraEngine
enableLocalAudio
:
YES
];
[
_agoraEngine
enableLocalAudio
:
YES
];
[
self
updateToSpeakerPlay
];
}
}
-
(
void
)
fus_closeMicro
{
-
(
void
)
fus_closeMicro
{
[
self
fus_switchRole
:
AgoraClientRoleAudience
];
[
self
fus_switchRole
:
AgoraClientRoleAudience
];
[
_agoraEngine
muteLocalAudioStream
:
YES
];
[
_agoraEngine
muteLocalAudioStream
:
YES
];
[
_agoraEngine
enableLocalAudio
:
NO
];
[
_agoraEngine
enableLocalAudio
:
NO
];
[
self
updateToSpeakerPlay
];
}
}
-
(
void
)
switchLocalMic
:
(
BOOL
)
open
{
-
(
void
)
switchLocalMic
:
(
BOOL
)
open
{
...
@@ -459,13 +466,12 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
...
@@ -459,13 +466,12 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
[
_agoraEngine
enableLocalAudio
:
YES
];
[
_agoraEngine
enableLocalAudio
:
YES
];
[
_agoraEngine
enableLocalVideo
:
YES
];
[
_agoraEngine
enableLocalVideo
:
YES
];
_agoraEngine
.
delegate
=
self
;
_agoraEngine
.
delegate
=
self
;
// [_agoraEngine setAudioSessionOperationRestriction:AgoraAudioSessionOperationRestrictionDeactivateSession];
// [_agoraEngine setAudioSessionOperationRestriction:AgoraAudioSessionOperationRestrictionConfigureSession];
// [_agoraEngine setEnableSpeakerphone:YES];
// [_agoraEngine disableExternalAudioSource];
// [_agoraEngine disableExternalAudioSource];
// 这个scenario只能是AgoraAudioScenarioGameStreaming,设置为别的会有回音
// 这个scenario只能是AgoraAudioScenarioGameStreaming,设置为别的会有回音
[
_agoraEngine
setAudioProfile
:
AgoraAudioProfileDefault
];
[
_agoraEngine
setAudioProfile
:
AgoraAudioProfileDefault
];
[
_agoraEngine
setAudioScenario
:
AgoraAudioScenario
GameStreaming
];
[
_agoraEngine
setAudioScenario
:
AgoraAudioScenario
ChatRoom
];
/// 开启硬编码
/// 开启硬编码
[
_agoraEngine
setParameters
:
@"{
\"
che.hardware_encoding
\"
: 1}"
];
[
_agoraEngine
setParameters
:
@"{
\"
che.hardware_encoding
\"
: 1}"
];
// 设置开启后台解码。
// 设置开启后台解码。
...
@@ -479,6 +485,7 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
...
@@ -479,6 +485,7 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
_agoraOtherPreview
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
UIView
.
fus_screenW
,
UIView
.
fus_screenH
)];
_agoraOtherPreview
=
[[
UIView
alloc
]
initWithFrame
:
CGRectMake
(
0
,
0
,
UIView
.
fus_screenW
,
UIView
.
fus_screenH
)];
_agoraOtherPreview
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_agoraOtherPreview
.
translatesAutoresizingMaskIntoConstraints
=
NO
;
_agoraOtherPreview
.
clipsToBounds
=
YES
;
_agoraOtherPreview
.
clipsToBounds
=
YES
;
[
self
updateToSpeakerPlay
];
}
}
return
_agoraEngine
;
return
_agoraEngine
;
}
}
...
@@ -587,6 +594,38 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
...
@@ -587,6 +594,38 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
return
_role
;
return
_role
;
}
}
-
(
void
)
updateToSpeakerPlay
{
[
NSObject
cancelPreviousPerformRequestsWithTarget
:
self
selector
:
@selector
(
delayUpdateToSpeakerPlay
)
object
:
nil
];
[
self
performSelector
:
@selector
(
delayUpdateToSpeakerPlay
)
afterDelay
:
2
];
}
-
(
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
;
}
}
if
(
needForceToSpeaker
)
{
[[
AVAudioSession
sharedInstance
]
overrideOutputAudioPort
:
AVAudioSessionPortOverrideSpeaker
error
:
nil
];
}
[[
AVAudioSession
sharedInstance
]
setActive
:
YES
error
:
nil
];
currentCategoryOptions
=
[
AVAudioSession
sharedInstance
].
categoryOptions
;
}
#pragma mark - AgoraVideoFrameDelegate
#pragma mark - AgoraVideoFrameDelegate
-
(
BOOL
)
onRenderVideoFrame
:
(
AgoraOutputVideoFrame
*
)
videoFrame
uid
:
(
NSUInteger
)
uid
channelId
:
(
NSString
*
)
channelId
{
-
(
BOOL
)
onRenderVideoFrame
:
(
AgoraOutputVideoFrame
*
)
videoFrame
uid
:
(
NSUInteger
)
uid
channelId
:
(
NSString
*
)
channelId
{
if
(
uid
==
FUSLiveHelper
.
shareInstance
.
roomInfoModel
.
roomId
.
integerValue
&&
if
(
uid
==
FUSLiveHelper
.
shareInstance
.
roomInfoModel
.
roomId
.
integerValue
&&
...
@@ -655,6 +694,8 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
...
@@ -655,6 +694,8 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
[
delegate
fus_agoraHelper
:
self
didJoinedOfUid
:
uid
];
[
delegate
fus_agoraHelper
:
self
didJoinedOfUid
:
uid
];
}
}
}
}
[
self
updateToSpeakerPlay
];
}
}
/**
/**
...
@@ -686,6 +727,8 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
...
@@ -686,6 +727,8 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
[
delegate
fus_agoraHelper
:
self
didJoinedOfUid
:
uid
];
[
delegate
fus_agoraHelper
:
self
didJoinedOfUid
:
uid
];
}
}
}
}
[
self
updateToSpeakerPlay
];
}
}
-
(
void
)
rtcEngine
:
(
AgoraRtcEngineKit
*
)
engine
didClientRoleChanged
:
(
AgoraClientRole
)
oldRole
newRole
:
(
AgoraClientRole
)
newRole
newRoleOptions
:
(
AgoraClientRoleOptions
*
)
newRoleOptions
{
-
(
void
)
rtcEngine
:
(
AgoraRtcEngineKit
*
)
engine
didClientRoleChanged
:
(
AgoraClientRole
)
oldRole
newRole
:
(
AgoraClientRole
)
newRole
newRoleOptions
:
(
AgoraClientRoleOptions
*
)
newRoleOptions
{
...
@@ -888,7 +931,6 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
...
@@ -888,7 +931,6 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
*/
*/
-
(
void
)
rtcEngine
:
(
AgoraRtcEngineKit
*
_Nonnull
)
engine
lastmileQuality
:
(
AgoraNetworkQuality
)
quality
-
(
void
)
rtcEngine
:
(
AgoraRtcEngineKit
*
_Nonnull
)
engine
lastmileQuality
:
(
AgoraNetworkQuality
)
quality
{
{
FUSLogVerbose
(
@"%s"
,
__func__
);
}
}
...
@@ -973,6 +1015,7 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
...
@@ -973,6 +1015,7 @@ NSString * const kLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
}
}
FUSLogVerbose
(
@"FUSStreamPushView:第一帧来了"
);
FUSLogVerbose
(
@"FUSStreamPushView:第一帧来了"
);
[
self
updateToSpeakerPlay
];
}
}
/** The remote video stream state has changed.
/** The remote video stream state has changed.
...
...
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