Commit 3755332c by suolong

修复连麦问题

parent b2e801f6
...@@ -620,6 +620,8 @@ ...@@ -620,6 +620,8 @@
3E261EA82F2C5FAB0008C0C0 /* FUSLinkMicMediator.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E261EA62F2C5FAB0008C0C0 /* FUSLinkMicMediator.m */; }; 3E261EA82F2C5FAB0008C0C0 /* FUSLinkMicMediator.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E261EA62F2C5FAB0008C0C0 /* FUSLinkMicMediator.m */; };
3E261EB02F2CA6890008C0C0 /* FUSLinkMicStreamConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E261EAE2F2CA6890008C0C0 /* FUSLinkMicStreamConfig.h */; }; 3E261EB02F2CA6890008C0C0 /* FUSLinkMicStreamConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E261EAE2F2CA6890008C0C0 /* FUSLinkMicStreamConfig.h */; };
3E261EB12F2CA6890008C0C0 /* FUSLinkMicStreamConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E261EAF2F2CA6890008C0C0 /* FUSLinkMicStreamConfig.m */; }; 3E261EB12F2CA6890008C0C0 /* FUSLinkMicStreamConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E261EAF2F2CA6890008C0C0 /* FUSLinkMicStreamConfig.m */; };
3E4DC89A2F580A46003070EC /* live_link_mic_boy_speak_anim.webp in Resources */ = {isa = PBXBuildFile; fileRef = 3E4DC8982F580A46003070EC /* live_link_mic_boy_speak_anim.webp */; };
3E4DC89B2F580A46003070EC /* live_link_mic_girl_speak_anim.webp in Resources */ = {isa = PBXBuildFile; fileRef = 3E4DC8992F580A46003070EC /* live_link_mic_girl_speak_anim.webp */; };
3E50054E2F556DC300058145 /* FUSLiveRTCData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E50054D2F556DC300058145 /* FUSLiveRTCData.swift */; }; 3E50054E2F556DC300058145 /* FUSLiveRTCData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E50054D2F556DC300058145 /* FUSLiveRTCData.swift */; };
BE189D972C733B450008418B /* FSRActiveModel.h in Headers */ = {isa = PBXBuildFile; fileRef = BE189CE52C733B450008418B /* FSRActiveModel.h */; }; BE189D972C733B450008418B /* FSRActiveModel.h in Headers */ = {isa = PBXBuildFile; fileRef = BE189CE52C733B450008418B /* FSRActiveModel.h */; };
BE189D982C733B450008418B /* FSRActiveModel.m in Sources */ = {isa = PBXBuildFile; fileRef = BE189CE62C733B450008418B /* FSRActiveModel.m */; }; BE189D982C733B450008418B /* FSRActiveModel.m in Sources */ = {isa = PBXBuildFile; fileRef = BE189CE62C733B450008418B /* FSRActiveModel.m */; };
...@@ -2498,6 +2500,8 @@ ...@@ -2498,6 +2500,8 @@
3E261EA62F2C5FAB0008C0C0 /* FUSLinkMicMediator.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSLinkMicMediator.m; sourceTree = "<group>"; }; 3E261EA62F2C5FAB0008C0C0 /* FUSLinkMicMediator.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSLinkMicMediator.m; sourceTree = "<group>"; };
3E261EAE2F2CA6890008C0C0 /* FUSLinkMicStreamConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSLinkMicStreamConfig.h; sourceTree = "<group>"; }; 3E261EAE2F2CA6890008C0C0 /* FUSLinkMicStreamConfig.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = FUSLinkMicStreamConfig.h; sourceTree = "<group>"; };
3E261EAF2F2CA6890008C0C0 /* FUSLinkMicStreamConfig.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSLinkMicStreamConfig.m; sourceTree = "<group>"; }; 3E261EAF2F2CA6890008C0C0 /* FUSLinkMicStreamConfig.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSLinkMicStreamConfig.m; sourceTree = "<group>"; };
3E4DC8982F580A46003070EC /* live_link_mic_boy_speak_anim.webp */ = {isa = PBXFileReference; lastKnownFileType = file; path = live_link_mic_boy_speak_anim.webp; sourceTree = "<group>"; };
3E4DC8992F580A46003070EC /* live_link_mic_girl_speak_anim.webp */ = {isa = PBXFileReference; lastKnownFileType = file; path = live_link_mic_girl_speak_anim.webp; sourceTree = "<group>"; };
3E50054D2F556DC300058145 /* FUSLiveRTCData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FUSLiveRTCData.swift; sourceTree = "<group>"; }; 3E50054D2F556DC300058145 /* FUSLiveRTCData.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FUSLiveRTCData.swift; sourceTree = "<group>"; };
842ED23FEE639B8A5B65A322 /* Pods-FUSShowRoomModule.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FUSShowRoomModule.debug.xcconfig"; path = "Target Support Files/Pods-FUSShowRoomModule/Pods-FUSShowRoomModule.debug.xcconfig"; sourceTree = "<group>"; }; 842ED23FEE639B8A5B65A322 /* Pods-FUSShowRoomModule.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FUSShowRoomModule.debug.xcconfig"; path = "Target Support Files/Pods-FUSShowRoomModule/Pods-FUSShowRoomModule.debug.xcconfig"; sourceTree = "<group>"; };
97F831FBE9C41BC899CF9232 /* Pods-FUSShowRoomModule.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FUSShowRoomModule.release.xcconfig"; path = "Target Support Files/Pods-FUSShowRoomModule/Pods-FUSShowRoomModule.release.xcconfig"; sourceTree = "<group>"; }; 97F831FBE9C41BC899CF9232 /* Pods-FUSShowRoomModule.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-FUSShowRoomModule.release.xcconfig"; path = "Target Support Files/Pods-FUSShowRoomModule/Pods-FUSShowRoomModule.release.xcconfig"; sourceTree = "<group>"; };
...@@ -7019,6 +7023,8 @@ ...@@ -7019,6 +7023,8 @@
00E6CE272F56F89F00B63797 /* img_liveroom_input_linkmic_waiting_animation.webp */, 00E6CE272F56F89F00B63797 /* img_liveroom_input_linkmic_waiting_animation.webp */,
00E6CE1A2F56E36500B63797 /* live_pk_host_win_draw_reward_type1_anim.webp */, 00E6CE1A2F56E36500B63797 /* live_pk_host_win_draw_reward_type1_anim.webp */,
00E6CE1B2F56E36500B63797 /* live_pk_host_win_draw_reward_type2_anim.webp */, 00E6CE1B2F56E36500B63797 /* live_pk_host_win_draw_reward_type2_anim.webp */,
3E4DC8982F580A46003070EC /* live_link_mic_boy_speak_anim.webp */,
3E4DC8992F580A46003070EC /* live_link_mic_girl_speak_anim.webp */,
BEF675EC2C6B156500A670FB /* live_linkmic_bgImg.png */, BEF675EC2C6B156500A670FB /* live_linkmic_bgImg.png */,
BEF675ED2C6B156500A670FB /* live_pk_background_image.png */, BEF675ED2C6B156500A670FB /* live_pk_background_image.png */,
00A1DCF62CA6B2C50000541F /* liveRoom_patAudience_pat_animate.webp */, 00A1DCF62CA6B2C50000541F /* liveRoom_patAudience_pat_animate.webp */,
...@@ -7585,6 +7591,8 @@ ...@@ -7585,6 +7591,8 @@
BED65B742C5CE68700668116 /* FUSFilterItemCell.xib in Resources */, BED65B742C5CE68700668116 /* FUSFilterItemCell.xib in Resources */,
BED65B8D2C5CE6EA00668116 /* FUSLiveTreasureBoxGrabView.xib in Resources */, BED65B8D2C5CE6EA00668116 /* FUSLiveTreasureBoxGrabView.xib in Resources */,
BEF6777B2C6B156600A670FB /* PK_Win_Animation_46@2x.png in Resources */, BEF6777B2C6B156600A670FB /* PK_Win_Animation_46@2x.png in Resources */,
3E4DC89A2F580A46003070EC /* live_link_mic_boy_speak_anim.webp in Resources */,
3E4DC89B2F580A46003070EC /* live_link_mic_girl_speak_anim.webp in Resources */,
BEF6779D2C6B156600A670FB /* pk_win_streak_2@3x.png in Resources */, BEF6779D2C6B156600A670FB /* pk_win_streak_2@3x.png in Resources */,
BEF677932C6B156600A670FB /* PK_Win_Animation_70@2x.png in Resources */, BEF677932C6B156600A670FB /* PK_Win_Animation_70@2x.png in Resources */,
BEF677372C6B156600A670FB /* PK_Start_Animation_4@2x.png in Resources */, BEF677372C6B156600A670FB /* PK_Start_Animation_4@2x.png in Resources */,
......
...@@ -2370,6 +2370,32 @@ typedef NS_ENUM(NSInteger, FUSStreamState) { ...@@ -2370,6 +2370,32 @@ typedef NS_ENUM(NSInteger, FUSStreamState) {
self.pipController.videoGravity = AVLayerVideoGravityResizeAspectFill; self.pipController.videoGravity = AVLayerVideoGravityResizeAspectFill;
self.pipController.delegate = self; self.pipController.delegate = self;
[self.pipController prepareWithCompletion:nil]; [self.pipController prepareWithCompletion:nil];
CGRect rect = FUSSwiftLiveHelper.shared.pkHelper.ocViewModel.currentPKState == FFPKStateNone ? CGRectMake(0, 0, UIView.fus_screenW, UIView.fus_screenW * 16 / 9) : CGRectMake(0, 0, UIView.fus_screenW, UIView.fus_screenW * 16 / 18);
[self setPictureInPictureVideoFrame:rect];
__weak typeof(self) weakSelf = self;
self.playView.playTypeDidChangedHandler = ^(FUSStreamPlayViewPlayType type) {
switch (type) {
case FUSStreamPlayViewPlayTypeNewPK:
{
CGRect rect = CGRectMake(0, 0, UIView.fus_screenW, UIView.fus_screenW * 16 / 18);
[weakSelf setPictureInPictureVideoFrame:rect];
break;
}
case FUSStreamPlayViewPlayTypePK:
case FUSStreamPlayViewPlayTypeNormal:
case FUSStreamPlayViewPlayTypeLinkMic:
[weakSelf setPictureInPictureVideoFrame:weakSelf.view.bounds];
break;
default:
break;
}
};
} }
self.pipController.contentView = self.playView; self.pipController.contentView = self.playView;
} }
......
...@@ -192,6 +192,7 @@ typedef void (^VELPipPrepareCompletionBlock)(VELPictureInPictureController * pip ...@@ -192,6 +192,7 @@ typedef void (^VELPipPrepareCompletionBlock)(VELPictureInPictureController * pip
// 当前是否已经有画中画在播放 // 当前是否已经有画中画在播放
+ (BOOL)isPictureInPictureStarted; + (BOOL)isPictureInPictureStarted;
@end @end
......
...@@ -81,6 +81,22 @@ FOUNDATION_EXTERN_INLINE void vel_sync_in_main_queue(dispatch_block_t block) { ...@@ -81,6 +81,22 @@ FOUNDATION_EXTERN_INLINE void vel_sync_in_main_queue(dispatch_block_t block) {
@property (nonatomic, copy) AVLayerVideoGravity videoGravity; @property (nonatomic, copy) AVLayerVideoGravity videoGravity;
- (void)rebuildSamplelayer; - (void)rebuildSamplelayer;
@end @end
// MARK: - interface VELPipContentSourceProvider
@interface VELPipContentSourceProvider : NSObject
@property (nonatomic, assign) CGSize videoSize;
@property (nonatomic, strong) VELPipSampleBufferView *sampleBufferView;
@property (nonatomic, strong) AVSampleBufferDisplayLayer *sampleDisplayLayer;
@property (nonatomic, assign) CVPixelBufferRef darkPixelBuffer;
@property (nonatomic, strong) dispatch_source_t darkFrameTimer;
@property (nonatomic, strong) dispatch_queue_t darkFrameQueue;
@property (nonatomic, copy) AVLayerVideoGravity videoGravity;
@property (nonatomic, copy) void (^sampleDisplayLayerChanged)(VELPipContentSourceProvider *provider);
- (void)enqueuePixelBuffer:(CVPixelBufferRef)pixelBuffer;
- (void)enqueueSampleBuffer:(CMSampleBufferRef)sampleBuffer;
- (void)destroy;
@end
static BOOL vel_pip_is_started = NO; static BOOL vel_pip_is_started = NO;
// MARK: interface VELPictureInPictureController // MARK: interface VELPictureInPictureController
@interface VELPictureInPictureController () @interface VELPictureInPictureController ()
...@@ -194,7 +210,7 @@ static VELPictureInPictureController *vel_instance_pip = nil; ...@@ -194,7 +210,7 @@ static VELPictureInPictureController *vel_instance_pip = nil;
self.type = type; self.type = type;
self.contentView = contentView; self.contentView = contentView;
self.originPipType = type; self.originPipType = type;
self.videoGravity = AVLayerVideoGravityResizeAspectFill;//AVLayerVideoGravityResize; self.videoGravity = AVLayerVideoGravityResizeAspect;//AVLayerVideoGravityResize;
self.autoHideContentController = NO; self.autoHideContentController = NO;
if (@available(iOS 14.2, *)) { if (@available(iOS 14.2, *)) {
self.canStartPictureInPictureAutomaticallyFromInline = NO; self.canStartPictureInPictureAutomaticallyFromInline = NO;
...@@ -212,12 +228,15 @@ static VELPictureInPictureController *vel_instance_pip = nil; ...@@ -212,12 +228,15 @@ static VELPictureInPictureController *vel_instance_pip = nil;
self.isRestoreUserInterface = NO; self.isRestoreUserInterface = NO;
self.prepareCompletionBlock = completion; self.prepareCompletionBlock = completion;
{ {
dispatch_async(dispatch_get_global_queue(0, 0), ^{
// 这部分代码,可根据自身业务需求进行配置 // 这部分代码,可根据自身业务需求进行配置
// 例如是否需要和别的 App 同时播放音频 // 例如是否需要和别的 App 同时播放音频
NSError *error = nil; NSError *error = nil;
AVAudioSessionCategoryOptions categoryOptions = AVAudioSessionCategoryOptionMixWithOthers | AVAudioSessionCategoryOptionAllowBluetooth | AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionAllowBluetoothA2DP; AVAudioSessionCategoryOptions categoryOptions = AVAudioSessionCategoryOptionMixWithOthers | AVAudioSessionCategoryOptionAllowBluetooth | AVAudioSessionCategoryOptionDefaultToSpeaker | AVAudioSessionCategoryOptionAllowBluetoothA2DP;
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:categoryOptions error:&error]; [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback withOptions:categoryOptions error:&error];
[[AVAudioSession sharedInstance] setActive:YES error:nil]; [[AVAudioSession sharedInstance] setActive:YES error:nil];
});
// if (error) { // if (error) {
// VELPipLog(LOG_TAG, @"set audio session playback error %@", error); // VELPipLog(LOG_TAG, @"set audio session playback error %@", error);
// [self notifyDeleteWithError:error]; // [self notifyDeleteWithError:error];
...@@ -330,6 +349,7 @@ static VELPictureInPictureController *vel_instance_pip = nil; ...@@ -330,6 +349,7 @@ static VELPictureInPictureController *vel_instance_pip = nil;
return vel_pip_is_started && vel_instance_pip != nil; return vel_pip_is_started && vel_instance_pip != nil;
} }
// MARK: - Private // MARK: - Private
- (void)autoSelectType { - (void)autoSelectType {
if (self.type != VELPictureInPictureTypeAuto) { if (self.type != VELPictureInPictureTypeAuto) {
...@@ -471,12 +491,25 @@ static VELPictureInPictureController *vel_instance_pip = nil; ...@@ -471,12 +491,25 @@ static VELPictureInPictureController *vel_instance_pip = nil;
if (!CGRectEqualToRect(_videoFrame, videoFrame)) { if (!CGRectEqualToRect(_videoFrame, videoFrame)) {
_videoFrame = videoFrame; _videoFrame = videoFrame;
[self setupPipHolderView]; [self setupPipHolderView];
// 新增:同步更新 sourceProvider 的尺寸
if (@available(iOS 15.0, *)) {
if (self.type == VELPictureInPictureTypeContentSource
&& self.sourceProvider) {
self.sourceProvider.videoSize = videoFrame.size;
}
}
// // 2. 刷新播放状态(原逻辑保留)上周不知道怎么弄加了这个自动偶尔成功 这周突然又不行了
// if (@available(iOS 15.0, *)) {
// [self.pipController invalidatePlaybackState];
// }
} }
} }
- (void)setVideoGravity:(AVLayerVideoGravity)videoGravity { - (void)setVideoGravity:(AVLayerVideoGravity)videoGravity {
if (![_videoGravity isEqualToString:videoGravity]) { if (![_videoGravity isEqualToString:videoGravity]) {
_videoGravity = AVLayerVideoGravityResizeAspectFill;//videoGravity.copy; _videoGravity = videoGravity;//videoGravity.copy;
[self setupVideoGravity]; [self setupVideoGravity];
} }
} }
...@@ -966,21 +999,6 @@ restoreUserInterfaceForPictureInPictureStopWithCompletionHandler:(void (^)(BOOL ...@@ -966,21 +999,6 @@ restoreUserInterfaceForPictureInPictureStopWithCompletionHandler:(void (^)(BOOL
#endif #endif
@end @end
// MARK: - interface VELPipContentSourceProvider
@interface VELPipContentSourceProvider : NSObject
@property (nonatomic, assign) CGSize videoSize;
@property (nonatomic, strong) VELPipSampleBufferView *sampleBufferView;
@property (nonatomic, strong) AVSampleBufferDisplayLayer *sampleDisplayLayer;
@property (nonatomic, assign) CVPixelBufferRef darkPixelBuffer;
@property (nonatomic, strong) dispatch_source_t darkFrameTimer;
@property (nonatomic, strong) dispatch_queue_t darkFrameQueue;
@property (nonatomic, copy) AVLayerVideoGravity videoGravity;
@property (nonatomic, copy) void (^sampleDisplayLayerChanged)(VELPipContentSourceProvider *provider);
- (void)enqueuePixelBuffer:(CVPixelBufferRef)pixelBuffer;
- (void)enqueueSampleBuffer:(CMSampleBufferRef)sampleBuffer;
- (void)destroy;
@end
// MARK: - interface VELSampleBufferPlaybackDelegate // MARK: - interface VELSampleBufferPlaybackDelegate
API_AVAILABLE(ios(15.0), tvos(15.0), macos(12.0)) API_UNAVAILABLE(watchos) API_AVAILABLE(ios(15.0), tvos(15.0), macos(12.0)) API_UNAVAILABLE(watchos)
@interface VELSampleBufferPlaybackDelegate : NSObject <AVPictureInPictureSampleBufferPlaybackDelegate> @interface VELSampleBufferPlaybackDelegate : NSObject <AVPictureInPictureSampleBufferPlaybackDelegate>
...@@ -1077,7 +1095,7 @@ static char kAssociatedObjectKey_pipPlaybackDelegate; ...@@ -1077,7 +1095,7 @@ static char kAssociatedObjectKey_pipPlaybackDelegate;
} }
- (void)setSampleLayerVideoGravity:(AVLayerVideoGravity)videoGravity { - (void)setSampleLayerVideoGravity:(AVLayerVideoGravity)videoGravity {
self.sourceProvider.sampleBufferView.videoGravity = AVLayerVideoGravityResizeAspectFill;//videoGravity; self.sourceProvider.sampleBufferView.videoGravity = videoGravity;//videoGravity;
} }
- (void)vel_enqueuePixelBuffer:(CVPixelBufferRef)pixelBuffer { - (void)vel_enqueuePixelBuffer:(CVPixelBufferRef)pixelBuffer {
...@@ -1108,7 +1126,7 @@ static char kAssociatedObjectKey_pipContentSourcePlayerView; ...@@ -1108,7 +1126,7 @@ static char kAssociatedObjectKey_pipContentSourcePlayerView;
[VELPipLoopPlayer initLoopPlayer]; [VELPipLoopPlayer initLoopPlayer];
self.contentSourcePlayerView = [[VELPipAVPlayerView alloc] init]; self.contentSourcePlayerView = [[VELPipAVPlayerView alloc] init];
self.contentSourcePlayerView.playerLayer.player = VELPipLoopPlayer.player; self.contentSourcePlayerView.playerLayer.player = VELPipLoopPlayer.player;
self.contentSourcePlayerView.playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;//AVLayerVideoGravityResize; self.contentSourcePlayerView.playerLayer.videoGravity = AVLayerVideoGravityResizeAspect;//AVLayerVideoGravityResize;
self.pipHolderView = self.contentSourcePlayerView; self.pipHolderView = self.contentSourcePlayerView;
AVPictureInPictureControllerContentSource *contentSource = [[AVPictureInPictureControllerContentSource alloc] AVPictureInPictureControllerContentSource *contentSource = [[AVPictureInPictureControllerContentSource alloc]
initWithPlayerLayer:self.contentSourcePlayerView.playerLayer]; initWithPlayerLayer:self.contentSourcePlayerView.playerLayer];
...@@ -1145,7 +1163,7 @@ static char kAssociatedObjectKey_pipContentSourcePlayerView; ...@@ -1145,7 +1163,7 @@ static char kAssociatedObjectKey_pipContentSourcePlayerView;
} }
- (void)setContentSourceAVPlayerLayerVideoGravity:(AVLayerVideoGravity)videoGravity { - (void)setContentSourceAVPlayerLayerVideoGravity:(AVLayerVideoGravity)videoGravity {
self.contentSourcePlayerView.playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;//videoGravity; self.contentSourcePlayerView.playerLayer.videoGravity = videoGravity;//videoGravity;
} }
@end @end
...@@ -1165,7 +1183,7 @@ static char kAssociatedObjectKey_pipAVplayerView; ...@@ -1165,7 +1183,7 @@ static char kAssociatedObjectKey_pipAVplayerView;
[VELPipLoopPlayer initLoopPlayer]; [VELPipLoopPlayer initLoopPlayer];
self.playerView = [[VELPipAVPlayerView alloc] init]; self.playerView = [[VELPipAVPlayerView alloc] init];
self.playerView.playerLayer.player = VELPipLoopPlayer.player; self.playerView.playerLayer.player = VELPipLoopPlayer.player;
self.playerView.playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;//AVLayerVideoGravityResize; self.playerView.playerLayer.videoGravity = AVLayerVideoGravityResizeAspect;//AVLayerVideoGravityResize;
self.pipHolderView = self.playerView; self.pipHolderView = self.playerView;
self.pipController = [[AVPictureInPictureController alloc] initWithPlayerLayer:self.playerView.playerLayer]; self.pipController = [[AVPictureInPictureController alloc] initWithPlayerLayer:self.playerView.playerLayer];
...@@ -1199,7 +1217,7 @@ static char kAssociatedObjectKey_pipAVplayerView; ...@@ -1199,7 +1217,7 @@ static char kAssociatedObjectKey_pipAVplayerView;
} }
- (void)setAVPlayerLayerVideoGravity:(AVLayerVideoGravity)videoGravity { - (void)setAVPlayerLayerVideoGravity:(AVLayerVideoGravity)videoGravity {
self.playerView.playerLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;//videoGravity; self.playerView.playerLayer.videoGravity = videoGravity;//videoGravity;
} }
@end @end
...@@ -1230,7 +1248,7 @@ static char kAssociatedObjectKey_pipAVPlayerViewController; ...@@ -1230,7 +1248,7 @@ static char kAssociatedObjectKey_pipAVPlayerViewController;
self.playerViewController.delegate = self; self.playerViewController.delegate = self;
self.playerViewController.player = VELPipLoopPlayer.player; self.playerViewController.player = VELPipLoopPlayer.player;
self.playerViewController.allowsPictureInPicturePlayback = YES; self.playerViewController.allowsPictureInPicturePlayback = YES;
self.playerViewController.videoGravity = AVLayerVideoGravityResizeAspectFill;//AVLayerVideoGravityResize; self.playerViewController.videoGravity = AVLayerVideoGravityResizeAspect;//AVLayerVideoGravityResize;
// self.playerViewController.showsPlaybackControls = NO; // don't set to NO // self.playerViewController.showsPlaybackControls = NO; // don't set to NO
if (@available(iOS 14.0, *)) { if (@available(iOS 14.0, *)) {
...@@ -1327,7 +1345,7 @@ static char kAssociatedObjectKey_pipAVPlayerViewController; ...@@ -1327,7 +1345,7 @@ static char kAssociatedObjectKey_pipAVPlayerViewController;
} }
- (void)setAVPlayerVCVideoGravity:(AVLayerVideoGravity)videoGravity { - (void)setAVPlayerVCVideoGravity:(AVLayerVideoGravity)videoGravity {
self.playerViewController.videoGravity = AVLayerVideoGravityResizeAspectFill;//videoGravity; self.playerViewController.videoGravity = videoGravity;//videoGravity;
} }
@end @end
...@@ -1503,8 +1521,15 @@ static VELPipLoopPlayer *vel_pip_loop_player_instance = nil; ...@@ -1503,8 +1521,15 @@ static VELPipLoopPlayer *vel_pip_loop_player_instance = nil;
VELPipLog(LOG_TAG, @"loop player prepare player item"); VELPipLog(LOG_TAG, @"loop player prepare player item");
NSURL *url; NSURL *url;
if (self.landspace) {
url = [[FUSShowRoomCenterBunble bundle] URLForResource:@"fake_video_for_pk" withExtension:@"mp4"];
} else {
url = [[FUSShowRoomCenterBunble bundle] URLForResource:@"fake_video" withExtension:@"mp4"];
}
AVAsset *asset = [AVAsset assetWithURL:url]; AVAsset *asset = [AVAsset assetWithURL:url];
self.playerItem = [[AVPlayerItem alloc] initWithAsset:asset]; self.playerItem = [[AVPlayerItem alloc] initWithAsset:asset];
} }
- (void)setPlayerItem:(AVPlayerItem *)playerItem { - (void)setPlayerItem:(AVPlayerItem *)playerItem {
...@@ -1725,6 +1750,14 @@ static char kAssociatedObjectKey_velAutoHideControlsView; ...@@ -1725,6 +1750,14 @@ static char kAssociatedObjectKey_velAutoHideControlsView;
} }
- (void)vel_autoHideSampleLayerSubview:(UIView *)view { - (void)vel_autoHideSampleLayerSubview:(UIView *)view {
if (self == view) {
return;
}
if (NSThread.isMainThread == false) {
FUSLogInfo(@"");
}
[self vel_autoHideSampleLayerSubview:view]; [self vel_autoHideSampleLayerSubview:view];
if (self.vel_autoHideSamplePlayerView) { if (self.vel_autoHideSamplePlayerView) {
[self hideSamplePlayerView]; [self hideSamplePlayerView];
...@@ -1795,7 +1828,7 @@ static char kAssociatedObjectKey_vel_viewController; ...@@ -1795,7 +1828,7 @@ static char kAssociatedObjectKey_vel_viewController;
- (void)setVideoGravity:(AVLayerVideoGravity)videoGravity { - (void)setVideoGravity:(AVLayerVideoGravity)videoGravity {
_videoGravity = videoGravity.copy; _videoGravity = videoGravity.copy;
@synchronized (self) { @synchronized (self) {
self.sampleLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;//videoGravity; self.sampleLayer.videoGravity = videoGravity;//videoGravity;
} }
} }
...@@ -1808,7 +1841,7 @@ static char kAssociatedObjectKey_vel_viewController; ...@@ -1808,7 +1841,7 @@ static char kAssociatedObjectKey_vel_viewController;
} }
self.sampleLayer = [[AVSampleBufferDisplayLayer alloc] init]; self.sampleLayer = [[AVSampleBufferDisplayLayer alloc] init];
self.sampleLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;//self.videoGravity; self.sampleLayer.videoGravity = self.videoGravity;//self.videoGravity;
self.sampleLayer.opaque = YES; self.sampleLayer.opaque = YES;
CMTimebaseRef timebase; CMTimebaseRef timebase;
CMTimebaseCreateWithSourceClock(nil, CMClockGetHostTimeClock(), &timebase); CMTimebaseCreateWithSourceClock(nil, CMClockGetHostTimeClock(), &timebase);
...@@ -1860,7 +1893,7 @@ static char kAssociatedObjectKey_vel_viewController; ...@@ -1860,7 +1893,7 @@ static char kAssociatedObjectKey_vel_viewController;
VELPipLog(LOG_TAG, @"content source provider init"); VELPipLog(LOG_TAG, @"content source provider init");
self.videoSize = CGSizeMake(360, 480); self.videoSize = CGSizeMake(360, 480);
self.sampleBufferView = [[VELPipSampleBufferView alloc] initWithFrame:CGRectMake(0, 0, 360, 480)]; self.sampleBufferView = [[VELPipSampleBufferView alloc] initWithFrame:CGRectMake(0, 0, 360, 480)];
self.sampleBufferView.videoGravity = AVLayerVideoGravityResizeAspectFill;//self.videoGravity; self.sampleBufferView.videoGravity = AVLayerVideoGravityResizeAspect;//self.videoGravity;
self.sampleDisplayLayer = self.sampleBufferView.sampleLayer; self.sampleDisplayLayer = self.sampleBufferView.sampleLayer;
[self startDarkFrameTimer]; [self startDarkFrameTimer];
} }
...@@ -1966,6 +1999,10 @@ static char kAssociatedObjectKey_vel_viewController; ...@@ -1966,6 +1999,10 @@ static char kAssociatedObjectKey_vel_viewController;
return; return;
} }
@synchronized (self) { @synchronized (self) {
// 检查layer是否有效并且是否在视图层级中
if (!_sampleDisplayLayer || !_sampleDisplayLayer.superlayer) {
return;
}
[_sampleDisplayLayer enqueueSampleBuffer:sampleBuffer]; [_sampleDisplayLayer enqueueSampleBuffer:sampleBuffer];
if (_sampleDisplayLayer.status == AVQueuedSampleBufferRenderingStatusFailed) { if (_sampleDisplayLayer.status == AVQueuedSampleBufferRenderingStatusFailed) {
[_sampleDisplayLayer flush]; [_sampleDisplayLayer flush];
...@@ -1990,7 +2027,7 @@ static char kAssociatedObjectKey_vel_viewController; ...@@ -1990,7 +2027,7 @@ static char kAssociatedObjectKey_vel_viewController;
// MARK: - Setter // MARK: - Setter
- (void)setVideoGravity:(AVLayerVideoGravity)videoGravity { - (void)setVideoGravity:(AVLayerVideoGravity)videoGravity {
_videoGravity = videoGravity.copy; _videoGravity = videoGravity.copy;
self.sampleDisplayLayer.videoGravity = AVLayerVideoGravityResizeAspectFill;//videoGravity; self.sampleDisplayLayer.videoGravity = videoGravity;//videoGravity;
} }
- (void)setVideoSize:(CGSize)videoSize { - (void)setVideoSize:(CGSize)videoSize {
......
...@@ -25,6 +25,9 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -25,6 +25,9 @@ NS_ASSUME_NONNULL_BEGIN
// 直播等级 // 直播等级
@property (nonatomic, copy) NSString *lev; @property (nonatomic, copy) NSString *lev;
// 性别
@property (nonatomic, copy) NSString *sex;
/// 用户贡献萤火 /// 用户贡献萤火
@property (nonatomic, copy) NSString *userOffer; @property (nonatomic, copy) NSString *userOffer;
......
...@@ -21,16 +21,12 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -21,16 +21,12 @@ NS_ASSUME_NONNULL_BEGIN
@property (nullable, nonatomic, strong) FUSLinkMicroModel *model; @property (nullable, nonatomic, strong) FUSLinkMicroModel *model;
@property (nonatomic, strong) UIButton *coverBtn;
@property (nonatomic, assign) BOOL cancelAnim; //不需要动画 @property (nonatomic, assign) BOOL cancelAnim; //不需要动画
@property (nonatomic, weak) id<FUSLinkMicroHeaderViewDelegate> delegate; @property (nonatomic, weak) id<FUSLinkMicroHeaderViewDelegate> delegate;
@property (nonatomic, copy) void(^completeRadarAnimationBlock)(void); @property (nonatomic, copy) void(^completeRadarAnimationBlock)(void);
/// 加号的动画
- (void)fus_changePlusBtnAnim:(BOOL)ifAnim;
/// 改变静音动态 /// 改变静音动态
/// @param mute 是否静音 /// @param mute 是否静音
...@@ -45,16 +41,13 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -45,16 +41,13 @@ NS_ASSUME_NONNULL_BEGIN
/// 停止所有动画 /// 停止所有动画
- (void)fus_stopAllAnimation; - (void)fus_stopAllAnimation;
/// 加号动画
- (void)fus_startPlusAnim;
/// 开始送礼动画 /// 开始送礼动画
/// @param url 礼物url /// @param url 礼物url
- (void)fus_startAnimWithImgUrl:(NSString *)url; - (void)fus_startAnimWithImgUrl:(NSString *)url;
- (void)fus_updateFrame; - (void)fus_updateFrame;
/// 取消红点
//- (void)fus_refreshUnreadRedPoint;
@end @end
......
...@@ -14,17 +14,18 @@ ...@@ -14,17 +14,18 @@
@interface FUSLinkMicroHeaderView () @interface FUSLinkMicroHeaderView ()
@property (nonatomic, strong) FUSRadarAnimImageViewView *faceView; /// UIImageView
@property (nonatomic, strong) YYAnimatedImageView *speakingAnimImageView;
@property (nonatomic, strong) UIView *unreadPointView; @property (nonatomic, strong) FUSRichIconView *faceView;
@property (nonatomic, strong) UIImageView *richImageView;
@property (nonatomic, strong) UIImageView *muteImageView; @property (nonatomic, strong) UIImageView *muteImageView;
@property (nonatomic, copy) NSString *lev; @property (nonatomic, strong) CBAutoScrollLabel *nicknameLabel;
@property (nonatomic, strong) UIView *gradeView;
@property (nonatomic, strong) UILabel *plusLb; @property (nonatomic, strong) UILabel *gradeLabel;
// 是否完成一轮动画 // 是否完成一轮动画
@property (nonatomic, assign) BOOL isAminCompleted; @property (nonatomic, assign) BOOL isAminCompleted;
...@@ -32,11 +33,7 @@ ...@@ -32,11 +33,7 @@
// 送礼动画的图片 // 送礼动画的图片
@property (nonatomic, strong) UIImageView *animImgView; @property (nonatomic, strong) UIImageView *animImgView;
@property (nonatomic, strong) UIImage *coverNormalImage; @property (nonatomic, strong) UIButton *coverBtn;
@property (nonatomic, strong) UIImage *coverHighlightedImage;
@property (nonatomic, strong) UIImage *coverSelectedImage;
...@@ -49,32 +46,17 @@ ...@@ -49,32 +46,17 @@
self = [super initWithFrame:frame]; self = [super initWithFrame:frame];
if (self) { if (self) {
_faceView = [[FUSRadarAnimImageViewView alloc] initWithFrame:CGRectMake(0, 0, self.height - 10, self.height - 10)];
_faceView.center = CGPointMake(self.width/2.0, self.height/2.0);
_faceView.userInteractionEnabled = NO;
_faceView.raderColor = [UIColor whiteColor];
_faceView.maxRadarScale = 1.5;
_faceView.totalRadarRingCount = 4;
_faceView.radarSpeed = 1.5;
_coverBtn = [UIButton buttonWithType:UIButtonTypeCustom];
_coverBtn.frame = self.bounds;
_coverBtn.imageView.contentMode = UIViewContentModeScaleAspectFit;
_plusLb = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 20, 10)];
_plusLb.text = @"+1";
_plusLb.font = [UIFont systemFontOfSize:10];
_plusLb.textColor = [UIColor colorWithHex:@"#00A0E9"];
_plusLb.centerX = self.centerX;
_plusLb.alpha = 0;
_isAminCompleted = YES; _isAminCompleted = YES;
_faceView = [[FUSRichIconView alloc] initWithFrame:CGRectMake(10, 0, 32, 32)];
_faceView.centerY = self.height / 2.0f;
self.speakingAnimImageView = [[YYAnimatedImageView alloc] initWithFrame:CGRectMake(0, 0, 65, 65)];
self.speakingAnimImageView.center = self.faceView.center;
self.speakingAnimImageView.hidden = YES;
[self addSubview:self.speakingAnimImageView];
[self addSubview:_faceView]; [self addSubview:_faceView];
[self addSubview:_plusLb];
_muteImageView = [[UIImageView alloc] initWithFrame:_faceView.frame]; _muteImageView = [[UIImageView alloc] initWithFrame:_faceView.frame];
_muteImageView.center = _muteImageView.center; _muteImageView.center = _muteImageView.center;
_muteImageView.contentMode = UIViewContentModeCenter; _muteImageView.contentMode = UIViewContentModeCenter;
...@@ -85,17 +67,34 @@ ...@@ -85,17 +67,34 @@
_muteImageView.hidden = YES; _muteImageView.hidden = YES;
[self addSubview:_muteImageView]; [self addSubview:_muteImageView];
_richImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 28, 14)];
_richImageView.contentMode = UIViewContentModeScaleAspectFit; CGFloat nicknameLabelX = self.faceView.right + 7;
_richImageView.centerX = _faceView.centerX; self.nicknameLabel = [[CBAutoScrollLabel alloc] initWithFrame:CGRectMake(nicknameLabelX, self.faceView.y + 2, self.width - nicknameLabelX, 15)];
_richImageView.centerY = _faceView.bottom; self.nicknameLabel.font = [UIFont fus_themeBoldFont:11];
[self addSubview:_richImageView]; self.nicknameLabel.fadeLength = 0;
self.nicknameLabel.textColor = [UIColor whiteColor];
self.nicknameLabel.shadowColor = [UIColor colorWithHex:@"000000" alpha:0.3];;
self.nicknameLabel.shadowOffset = CGSizeMake(0.8, 0.5);
[self addSubview:self.nicknameLabel];
self.gradeView = [[UIView alloc] initWithFrame:CGRectMake(self.faceView.centerX, self.nicknameLabel.bottom + 2, 40, 10)];
self.gradeView.backgroundColor = [UIColor colorWithWhite:0 alpha:0.4];
self.gradeView.layer.cornerRadius = 5;
self.gradeView.layer.masksToBounds = YES;
[self insertSubview:self.gradeView belowSubview:self.speakingAnimImageView];
self.gradeLabel = [[UILabel alloc] initWithFrame:CGRectMake(nicknameLabelX, 0, 15, 10)];
self.gradeLabel.font = [UIFont fus_themeBoldFont:7];
self.gradeLabel.textColor = [UIColor whiteColor];
[self addSubview:self.gradeLabel];
_animImgView = [[UIImageView alloc] initWithFrame:_faceView.frame]; _animImgView = [[UIImageView alloc] initWithFrame:_faceView.frame];
[self addSubview:_animImgView]; [self addSubview:_animImgView];
[self addSubview:_coverBtn]; self.coverBtn = [UIButton buttonWithType:UIButtonTypeCustom];
[_coverBtn addTarget:self action:@selector(onClickAction:) forControlEvents:UIControlEventTouchUpInside]; [self.coverBtn addTarget:self action:@selector(onClickAction:) forControlEvents:UIControlEventTouchUpInside];
[self addSubview:self.coverBtn];
} }
return self; return self;
} }
...@@ -108,126 +107,86 @@ ...@@ -108,126 +107,86 @@
} }
- (void)setModel:(FUSLinkMicroModel *)model{ - (void)setModel:(FUSLinkMicroModel *)model{
BOOL modelHasChanged = _model.uid.integerValue != model.uid.integerValue;
_model = model; _model = model;
NSInteger level = model.level.integerValue; if (model.sex.integerValue == 1) {
self.speakingAnimImageView.image = [FUSShowRoomCenterBunble webpImageName:@"live_link_mic_boy_speak_anim"];
if (!model) { } else {
[self.coverBtn setImage:nil forState:UIControlStateNormal]; self.speakingAnimImageView.image = [FUSShowRoomCenterBunble webpImageName:@"live_link_mic_girl_speak_anim"];
[self.coverBtn setImage:nil forState:UIControlStateHighlighted];
[self.coverBtn setImage:nil forState:UIControlStateSelected];
self.faceView.imageView.image = nil;
_richImageView.image = nil;
_muteImageView.hidden = YES;
self.transform = CGAffineTransformMakeScale(1.f, 1.f);
[self fus_stopRadarAnimation];
return;
} }
// 是否是开麦状态 if (modelHasChanged) {
[self fus_changeMuteStatus:!model.isOpenMic];
BOOL enlargeFace = [[[NSUserDefaults standardUserDefaults] objectForKey:FUSLiveUDKeys.fus_LIVE_LINKMIC_FACE_ENLARGE_SWITCH] boolValue]; NSInteger level = 0;
if (_cancelAnim) { if (model.isHide.boolValue) {
enlargeFace = NO; level = -1;
} }
if (![NSDictionary isNullWithDictionary:model.privilege]) {
if (model.uid.integerValue == 0) { if ([model.privilege[@"richPower"] boolValue]) {
self.faceView.imageView.image = nil; level = model.level.integerValue;
if (self.coverNormalImage == nil) {
self.coverNormalImage = [FUSShowRoomCenterBunble imageNamed:model.face];
} }
if (self.coverHighlightedImage == nil) {
self.coverHighlightedImage = [FUSShowRoomCenterBunble imageNamed:model.hightlightImgUrl];
} }
[self.faceView fus_setupLiveIconWithFacePath:model.face level:level];
if (self.coverSelectedImage == nil) { self.nicknameLabel.text = model.nickname;
self.coverSelectedImage = [FUSShowRoomCenterBunble animatedImageNamed:@"live_link_micro_request_" duration:1];
} }
[self.nicknameLabel scrollLabelIfNeeded];
[self.coverBtn setImage:self.coverNormalImage forState:UIControlStateNormal]; self.gradeLabel.text = model.userOffer;
[self.coverBtn setImage:self.coverHighlightedImage forState:UIControlStateHighlighted]; [self.gradeLabel sizeToFit];
[self.coverBtn setImage:self.coverSelectedImage forState:UIControlStateSelected];
[self.coverBtn setImageEdgeInsets:UIEdgeInsetsMake(5, 5, 5, 5)];
_richImageView.image = nil;
self.transform = CGAffineTransformMakeScale(1.f, 1.f);
[self fus_stopRadarAnimation];
}else{
[self.coverBtn setImageEdgeInsets:UIEdgeInsetsMake(0, 0, 0, 0)];
// 头像
[self.faceView.imageView setLiveFaceWebImageWithSubURLString:model.face placeholder:nil];
[self.coverBtn setImage:nil forState:UIControlStateNormal];
[self.coverBtn setImage:nil forState:UIControlStateHighlighted];
[self.coverBtn setImage:nil forState:UIControlStateSelected];
}
// 是否是开麦状态
[self fus_changeMuteStatus:!model.isOpenMic];
NSLog(@"suolong:model.isSpeaking=== %ld", model.isSpeaking);
if (model.isSpeaking && _isAminCompleted && model.isOpenMic && _muteImageView.hidden) { if (model.isSpeaking && _isAminCompleted && model.isOpenMic && _muteImageView.hidden) {
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(fus_stopHeaderViewRadarAnimation) object:self]; [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(fus_stopSpeakingAnimation) object:self];
[self performSelector:@selector(fus_stopHeaderViewRadarAnimation) withObject:self afterDelay:2]; [self performSelector:@selector(fus_stopHeaderViewRadarAnimation) withObject:self afterDelay:2];
_isAminCompleted = NO; _isAminCompleted = NO;
model.oldSpeaking = YES; model.oldSpeaking = YES;
if (enlargeFace) { [self fus_startSpeakingAnimation];
self.transform = CGAffineTransformMakeScale(1.2f, 1.2f);
}
[self fus_startRadarAnimation];
}else if(_isAminCompleted){ }else if(_isAminCompleted){
model.oldSpeaking = NO; model.oldSpeaking = NO;
self.transform = CGAffineTransformMakeScale(1.f, 1.f); [self fus_stopSpeakingAnimation];
[self fus_stopRadarAnimation]; [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(fus_stopSpeakingAnimation) object:self];
// [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(fus_stopHeaderViewRadarAnimation) object:self];
} }
[self fus_updateFrame:modelHasChanged];
}
// 富豪等级 - (void)layoutSubviews{
if (![NSDictionary isNull:model.privilege]) { [super layoutSubviews];
if ([model.privilege[@"richPower"] boolValue]) { [self fus_updateFrame:YES];
_richImageView.hidden = NO; }
UIImage *vipImage = [UIImage fus_imageWithLevel:model.level.integerValue];;
_richImageView.image = vipImage;
if (vipImage) {
_richImageView.width = ceil(_richImageView.height / vipImage.size.height * vipImage.size.width);
}
}else{
_richImageView.hidden = YES;
_richImageView.image = nil;
return;
}
}
BOOL sameLev = NO; - (void)fus_updateFrame {
if (_lev.integerValue == level) { [self fus_updateFrame:YES];
sameLev = YES;
}
_lev = model.level;
} }
- (void)layoutSubviews{ - (void)fus_updateFrame:(BOOL)hasChanged {
[super layoutSubviews]; if (hasChanged) {
_faceView.frame = CGRectMake(0, 0, CGRectGetHeight(self.bounds) - 10, CGRectGetHeight(self.bounds) - 10); _faceView.frame = CGRectMake(10, 0, 32, 32);
_faceView.center = CGPointMake(self.width/2.0, self.height/2.0); _faceView.centerY = self.height / 2.0f;
CGFloat nicknameLabelX = self.faceView.right + 7;
self.nicknameLabel.frame = CGRectMake(nicknameLabelX, self.faceView.y + 2, self.width - nicknameLabelX, 15);
self.gradeLabel.x = nicknameLabelX;
}
_plusLb.centerX = self.centerX;
self.speakingAnimImageView.center = self.faceView.center;
_muteImageView.frame = _faceView.frame; _muteImageView.frame = _faceView.frame;
_muteImageView.layer.cornerRadius = _muteImageView.height/2.0; _muteImageView.layer.cornerRadius = _muteImageView.height/2.0;
_richImageView.centerX = _faceView.centerX; [self.gradeLabel sizeToFit];
_richImageView.centerY = _faceView.bottom; self.gradeLabel.height = 10;
self.gradeView.width = self.gradeLabel.right + 5 - self.faceView.centerX;
self.gradeLabel.centerY = self.gradeView.centerY;
_animImgView.frame = _faceView.frame; _animImgView.frame = _faceView.frame;
_coverBtn.frame = self.bounds; self.coverBtn.frame = self.bounds;
}
- (void)fus_updateFrame{
[self layoutSubviews];
} }
- (void)fus_stopHeaderViewRadarAnimation{ - (void)fus_stopHeaderViewRadarAnimation{
...@@ -236,42 +195,29 @@ ...@@ -236,42 +195,29 @@
if (_completeRadarAnimationBlock) { if (_completeRadarAnimationBlock) {
_completeRadarAnimationBlock(); _completeRadarAnimationBlock();
} }
[self fus_stopAllAnimation];
} }
- (void)fus_startRadarAnimation{ - (void)fus_startSpeakingAnimation{
if (!_muteImageView.hidden) { if (!_muteImageView.hidden) {
[self fus_stopRadarAnimation]; [self fus_stopSpeakingAnimation];
return; return;
} }
[self.faceView fus_startRadarAnimation]; self.speakingAnimImageView.hidden = NO;
[self.speakingAnimImageView startAnimating];
} }
- (void)fus_stopRadarAnimation{ - (void)fus_stopSpeakingAnimation{
[self.faceView fus_stopRadarAnimation]; self.speakingAnimImageView.hidden = YES;
[self.speakingAnimImageView stopAnimating];
} }
- (void)fus_stopAllAnimation{ - (void)fus_stopAllAnimation{
_isAminCompleted = YES; _isAminCompleted = YES;
_model.oldSpeaking = NO; _model.oldSpeaking = NO;
self.transform = CGAffineTransformMakeScale(1.f, 1.f); [self fus_stopSpeakingAnimation];
[self fus_stopRadarAnimation];
}
- (void)fus_refreshUnreadRedPoint{
NSInteger count = [[[NSUserDefaults standardUserDefaults] objectForKey:FUSLiveUDKeys.fus_LIVE_NEW_LINKMIC_UNREAD] integerValue];
if (count > 0 && _model.uid.intValue == 0) {
_unreadPointView.hidden = NO;
}else{
_unreadPointView.hidden = YES;
}
} }
- (void)fus_changePlusBtnAnim:(BOOL)ifAnim{
_coverBtn.selected = ifAnim;
}
/// 设置静音状态 /// 设置静音状态
/// @param mute 是否静音 /// @param mute 是否静音
- (void)fus_changeMuteStatus:(BOOL)mute{ - (void)fus_changeMuteStatus:(BOOL)mute{
...@@ -285,20 +231,11 @@ ...@@ -285,20 +231,11 @@
} }
} }
- (void)fus_startPlusAnim{
_plusLb.y = 0;
_plusLb.alpha = 1;
[UIView animateWithDuration:1 animations:^{
self.plusLb.y -= 30;
self.plusLb.alpha = 0;
}];
}
- (void)fus_startAnimWithImgUrl:(NSString *)url{ - (void)fus_startAnimWithImgUrl:(NSString *)url{
_animImgView.image = nil; _animImgView.image = nil;
// [_animImgView.layer removeAllAnimations];
[_animImgView setWebImageWithSubURLString:url]; [_animImgView setWebImageWithSubURLString:url placeholder:nil];
CAKeyframeAnimation *scaleAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"]; CAKeyframeAnimation *scaleAnimation = [CAKeyframeAnimation animationWithKeyPath:@"transform.scale"];
scaleAnimation.values = @[@1,@1.5,@1,@1.3,@1.5]; scaleAnimation.values = @[@1,@1.5,@1,@1.3,@1.5];
...@@ -318,8 +255,4 @@ ...@@ -318,8 +255,4 @@
[_animImgView.layer addAnimation:animationGroup forKey:nil]; [_animImgView.layer addAnimation:animationGroup forKey:nil];
} }
- (void)dealloc {
FUSLogInfo(@"%s",__func__);
}
@end @end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment