个播房背景显示优化,退房后停掉关注主播定时器

This commit is contained in:
chenguilong
2022-03-10 15:37:56 +08:00
parent 1923978f38
commit 244ed6b24d
2 changed files with 14 additions and 7 deletions

View File

@@ -22,6 +22,7 @@
@interface XPRoomBackContainerView ()
///
@property (nonatomic,strong) NetImageView *backImageView;
///
@property (nonatomic, strong) SVGAImageView *svgDisplayView;
@property (nonatomic, strong) SVGAParserManager *parserManager;
///host
@@ -43,8 +44,8 @@
#pragma mark - Private Method
- (void)initSubViews {
[self addSubview:self.backImageView];
[self addSubview:self.svgDisplayView];
[self addSubview:self.backImageView];
}
- (void)initSubViewConstraints {
@@ -70,10 +71,8 @@
///MARK: BY lvjunhang, 2018-12-03,UIViewContentModeScaleAspectFit
self.backImageView.contentMode = UIViewContentModeScaleAspectFill;
if ([roomInfo.backPic containsString:@".svga"]) { //SVGA
self.backImageView.hidden = YES;
self.svgDisplayView.hidden = NO;
@weakify(self);
//@"https://img.erbanyy.com/Noble_OpenEffect_5.svga"
[self.parserManager loadSvgaWithURL:[NSURL URLWithString:roomInfo.backPic] completionBlock:^(SVGAVideoEntity * _Nullable videoItem) {
@strongify(self);
if (videoItem != nil) {
@@ -100,12 +99,10 @@
} else { //
[self.svgDisplayView stopAnimation];
self.svgDisplayView.hidden = YES;
self.backImageView.hidden = NO;
self.backImageView.imageUrl = roomInfo.backPic;
}
}else { //
if (roomInfo.type == RoomType_Anchor) {
self.backImageView.hidden = YES;
self.svgDisplayView.hidden = NO;
@weakify(self);
NSString *bgString = [[NSBundle mainBundle] pathForResource:@"anchor_room_bg" ofType:@"svga"];
@@ -135,8 +132,8 @@
}];
return;
}
[self.svgDisplayView stopAnimation];
self.svgDisplayView.hidden = YES;
self.backImageView.hidden = NO;
self.backImageView.contentMode = UIViewContentModeScaleAspectFill;
}
}

View File

@@ -46,6 +46,13 @@
@end
@implementation XPRoomFunctionContainerView
- (void)dealloc {
if (self.followAnchorTimer != nil) {
dispatch_source_cancel(self.followAnchorTimer);
}
}
- (instancetype)initWithdelegate:(id<RoomHostDelegate>)delegate {
self = [super init];
if (self) {
@@ -229,7 +236,10 @@
dispatch_source_set_event_handler(self.followAnchorTimer, ^{
dispatch_async(dispatch_get_main_queue(), ^{
@strongify(self);
dispatch_source_cancel(self.followAnchorTimer);
if (self.followAnchorTimer != nil) {
dispatch_source_cancel(self.followAnchorTimer);
self.followAnchorTimer = nil;
}
RoomInfoModel* roomInfo = self.delegate.getRoomInfo;
NSString *roomUid = [NSString stringWithFormat:@"%zd", roomInfo.uid];
NSString * uid = [[AccountInfoStorage instance] getUid];