增加换肤功能

This commit is contained in:
启星
2025-08-14 10:07:49 +08:00
parent f6964c1e89
commit 4f9318d98e
8789 changed files with 978530 additions and 2 deletions

View File

@@ -0,0 +1,16 @@
//
// QXInviteToMicView.h
// QXLive
//
// Created by 启星 on 2025/5/8.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXInviteToMicView : UIView
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,14 @@
//
// QXInviteToMicView.m
// QXLive
//
// Created by on 2025/5/8.
//
#import "QXInviteToMicView.h"
@implementation QXInviteToMicView
@end

View File

@@ -0,0 +1,27 @@
//
// QXSeatHeaderView.h
// QXLive
//
// Created by 启星 on 2025/5/6.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface QXSeatHeaderView : UIView
/// 头像装饰
@property (nonatomic,strong)UIImageView *dressImageView;
/// 头像
@property (nonatomic,strong)UIImageView *headImageView;
/// 昵称
//@property (nonatomic,strong)UILabel *nameLabel;
/// 按钮
@property (nonatomic,strong)UIButton *headBtn;
-(void)setHeadIcon:(NSString*)headerIcon
dress:(NSString*)dress;
@end
NS_ASSUME_NONNULL_END

View File

@@ -0,0 +1,120 @@
//
// QXSeatHeaderView.m
// QXLive
//
// Created by on 2025/5/6.
//
#import "QXSeatHeaderView.h"
#import "QXEffectSvgaView.h"
#import "UIView+VAP.h"
#import "QXFileManager.h"
@interface QXSeatHeaderView()<HWDMP4PlayDelegate>
@property (nonatomic,strong) QXEffectSvgaView *svgaView;
@property (nonatomic,strong) VAPView *mp4View;
@end
@implementation QXSeatHeaderView
- (instancetype)initWithCoder:(NSCoder *)coder
{
self = [super initWithCoder:coder];
if (self) {
[self initSubViews];
}
return self;
}
- (instancetype)initWithFrame:(CGRect)frame
{
self = [super initWithFrame:frame];
if (self) {
[self initSubViews];
}
return self;
}
-(void)layoutSubviews{
[super layoutSubviews];
[self.headImageView addRoundedCornersWithRadius:self.headImageView.height/2];
// [self.svgaView addRoundedCornersWithRadius:self.headImageView.height/2-2];
}
-(void)initSubViews{
self.headImageView = [[UIImageView alloc] init];
self.headImageView.image = [UIImage imageNamed:@"user_header_placehoulder"];
self.headImageView.contentMode = UIViewContentModeScaleAspectFill;
self.headImageView.clipsToBounds = YES;
[self addSubview:self.headImageView];
[self.headImageView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.right.bottom.top.equalTo(self);
}];
[self addSubview:self.svgaView];
[self.svgaView mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.equalTo(self).offset(-6);
make.right.bottom.equalTo(self).offset(6);
}];
[self addSubview:self.mp4View];
[self.mp4View mas_makeConstraints:^(MASConstraintMaker *make) {
make.left.top.equalTo(self).offset(-6);
make.right.bottom.equalTo(self).offset(6);
}];
}
-(void)setHeadIcon:(NSString *)headerIcon
dress:(NSString *)dress{
[self.headImageView sd_setImageWithURL:[NSURL URLWithString:headerIcon] placeholderImage:[UIImage imageNamed:@"user_header_placehoulder"]];
if (dress.length > 0 && ([dress hasPrefix:@"http"] || [dress hasPrefix:@"https"])) {
if ([dress isExist]) {
if ([dress hasSuffix:@"svga"]) {
[self.svgaView setHidden:NO];
[self.mp4View stopHWDMP4];
[self.mp4View setHidden:YES];
[self.svgaView destroySvga];
[self.svgaView loadSVGAPlayerWith:dress inBundle:NO loop:INTMAX_MAX];
}else if ([dress hasSuffix:@"mp4"]){
[self.svgaView setHidden:YES];
[self.mp4View setHidden:NO];
[self.mp4View stopHWDMP4];
MJWeakSelf
[[QXRequset shareInstance] downloadVideoPlayerWithUrl:dress completion:^(BOOL result, NSString * _Nonnull fileName) {
NSString *videoPath = [QXFileManager getGiftVideoPath:dress.lastPathComponent];
[weakSelf.mp4View playHWDMP4:videoPath repeatCount:INTMAX_MAX delegate:self];
}];
}else{
[self.mp4View stopHWDMP4];
[self.svgaView destroySvga];
[self.svgaView setHidden:YES];
[self.mp4View setHidden:YES];
}
} else {
[self.mp4View stopHWDMP4];
[self.svgaView destroySvga];
[self.svgaView setHidden:YES];
[self.mp4View setHidden:YES];
}
}else{
[self.mp4View stopHWDMP4];
[self.svgaView destroySvga];
[self.svgaView setHidden:YES];
[self.mp4View setHidden:YES];
}
}
- (QXEffectSvgaView *)svgaView {
if (!_svgaView) {
_svgaView = [[QXEffectSvgaView alloc] initWithFrame:CGRectZero isAutoPlay:YES];
_svgaView.hidden = YES;
}
return _svgaView;
}
- (VAPView *)mp4View {
if (!_mp4View) {
_mp4View = [[VAPView alloc] initWithFrame:CGRectZero];
_mp4View.hwd_enterBackgroundOP = HWDMP4EBOperationTypePauseAndResume;
_mp4View.contentMode = UIViewContentModeScaleAspectFit;
_mp4View.userInteractionEnabled = NO;
_mp4View.backgroundColor = [UIColor clearColor];
_mp4View.hidden = YES;
}
return _mp4View;
}
@end