个播房背景显示优化,退房后停掉关注主播定时器
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
@@ -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];
|
||||
|
Reference in New Issue
Block a user