Commit 4b43dace by pidan

备份代码

parent 2f03c130
Showing with 281 additions and 145 deletions
...@@ -188,6 +188,7 @@ ...@@ -188,6 +188,7 @@
self.mtkView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; self.mtkView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
self.mtkView.backgroundColor = UIColor.clearColor; self.mtkView.backgroundColor = UIColor.clearColor;
self.mtkView.device = MTLCreateSystemDefaultDevice(); self.mtkView.device = MTLCreateSystemDefaultDevice();
self.mtkView.colorPixelFormat = MTLPixelFormatRGBA8Unorm;
[self addSubview:self.mtkView]; [self addSubview:self.mtkView];
self.metalRenderer = [[BDAlphaPlayerMetalRenderer alloc] initWithMetalKitView:self.mtkView]; self.metalRenderer = [[BDAlphaPlayerMetalRenderer alloc] initWithMetalKitView:self.mtkView];
......
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
self.numVertices = sizeof(quadVertices) / sizeof(BDAlphaPlayerVertex); self.numVertices = sizeof(quadVertices) / sizeof(BDAlphaPlayerVertex);
} }
-(void)setupPipeline - (void)setupPipeline
{ {
NSString *filePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"BDAlphaPlayer.bundle/default" ofType:@"metallib"]; NSString *filePath = [[NSBundle bundleForClass:[self class]] pathForResource:@"BDAlphaPlayer.bundle/default" ofType:@"metallib"];
NSError *error = nil; NSError *error = nil;
...@@ -132,11 +132,14 @@ ...@@ -132,11 +132,14 @@
pipelineStateDescriptor.colorAttachments[0].pixelFormat = self.mtkView.colorPixelFormat; pipelineStateDescriptor.colorAttachments[0].pixelFormat = self.mtkView.colorPixelFormat;
pipelineStateDescriptor.colorAttachments[0].blendingEnabled = true; pipelineStateDescriptor.colorAttachments[0].blendingEnabled = true;
pipelineStateDescriptor.colorAttachments[0].rgbBlendOperation = MTLBlendOperationAdd; pipelineStateDescriptor.colorAttachments[0].rgbBlendOperation = MTLBlendOperationAdd;
pipelineStateDescriptor.colorAttachments[0].sourceRGBBlendFactor = MTLBlendFactorOne;
pipelineStateDescriptor.colorAttachments[0].destinationRGBBlendFactor = MTLBlendFactorOne;
pipelineStateDescriptor.colorAttachments[0].alphaBlendOperation = MTLBlendOperationMin; pipelineStateDescriptor.colorAttachments[0].alphaBlendOperation = MTLBlendOperationMin;
pipelineStateDescriptor.colorAttachments[0].sourceRGBBlendFactor = MTLBlendFactorSourceAlpha;
pipelineStateDescriptor.colorAttachments[0].sourceAlphaBlendFactor = MTLBlendFactorOne; pipelineStateDescriptor.colorAttachments[0].sourceAlphaBlendFactor = MTLBlendFactorOne;
pipelineStateDescriptor.colorAttachments[0].destinationAlphaBlendFactor = MTLBlendFactorOne;
pipelineStateDescriptor.colorAttachments[0].destinationRGBBlendFactor = MTLBlendFactorOneMinusSourceAlpha;
pipelineStateDescriptor.colorAttachments[0].destinationAlphaBlendFactor = MTLBlendFactorOneMinusSourceAlpha;
self.pipelineState = [self.mtkView.device newRenderPipelineStateWithDescriptor:pipelineStateDescriptor error:NULL]; self.pipelineState = [self.mtkView.device newRenderPipelineStateWithDescriptor:pipelineStateDescriptor error:NULL];
self.commandQueue = [self.mtkView.device newCommandQueue]; self.commandQueue = [self.mtkView.device newCommandQueue];
} }
......
...@@ -8,48 +8,55 @@ ...@@ -8,48 +8,55 @@
#include <metal_stdlib> #include <metal_stdlib>
#include "BDAlphaPlayerMetalShaderType.h" #include "BDAlphaPlayerMetalShaderType.h"
using namespace metal; using namespace metal;
typedef struct { // ────────────────────────────── 1. 顶点阶段 ──────────────────────────────
struct RasterizerData
{
float4 clipSpacePosition [[position]]; float4 clipSpacePosition [[position]];
float2 textureCoordinate; float2 textureCoordinate;
} RasterizerData; };
vertex RasterizerData vertexShader(uint vertexID [[ vertex_id ]], vertex RasterizerData vertexShader(uint vertexID [[ vertex_id ]], constant BDAlphaPlayerVertex *vertexArray [[buffer(BDAlphaPlayerVertexInputIndexVertices) ]])
constant BDAlphaPlayerVertex *vertexArray [[ buffer(BDAlphaPlayerVertexInputIndexVertices) ]]) { {
RasterizerData out; RasterizerData out;
out.clipSpacePosition = vertexArray[vertexID].position; out.clipSpacePosition = vertexArray[vertexID].position;
out.textureCoordinate = vertexArray[vertexID].textureCoordinate; out.textureCoordinate = vertexArray[vertexID].textureCoordinate;
return out; return out;
} }
fragment float4 samplingShader(RasterizerData input [[stage_in]], // 片元着色器
texture2d<float> textureY [[ texture(BDAlphaPlayerFragmentTextureIndexTextureY) ]], fragment float4 samplingShader(RasterizerData in [[stage_in]],
texture2d<float> textureUV [[ texture(BDAlphaPlayerFragmentTextureIndexTextureUV) ]], // Y / UV —— 必填
constant BDAlphaPlayerConvertMatrix *convertMatrix [[ buffer(BDAlphaPlayerFragmentInputIndexMatrix) ]]) texture2d<float, access::sample> textureY [[
texture(BDAlphaPlayerFragmentTextureIndexTextureY)]],
texture2d<float, access::sample> textureUV [[texture(BDAlphaPlayerFragmentTextureIndexTextureUV)]],
// 颜色转换矩阵 (仅用于 YUV→RGB,不再给 α 用)
constant BDAlphaPlayerConvertMatrix& cvtMat [[buffer(BDAlphaPlayerFragmentInputIndexMatrix)]]
)
{ {
constexpr sampler textureSamplerLinear (mag_filter::linear, min_filter::linear); constexpr sampler s(address::clamp_to_edge, filter::linear);
constexpr sampler textureSamplerNearest (mag_filter::nearest, min_filter::nearest);
// 主体颜色采样(右半边) const float split = 0.5; // 避免 0
float2 colorTexCoord = float2(input.textureCoordinate.x / 2 + 0.5, input.textureCoordinate.y);
float yColor = textureY.sample(textureSamplerLinear, colorTexCoord).r;
float2 uvColor = textureUV.sample(textureSamplerLinear, colorTexCoord).rg;
float3 yuvColor = float3(yColor, uvColor); // ───── 2.1 取颜色 ─────
float3 rgb = convertMatrix->matrix * (yuvColor + convertMatrix->offset); float2 uvColor = float2(in.textureCoordinate.x * split + (1.0 - split),
in.textureCoordinate.y);
// Alpha 采样(左半边) float3 yuv = float3(textureY .sample(s, uvColor).r,
float2 alphaTexCoord = float2(input.textureCoordinate.x / 2, input.textureCoordinate.y); textureUV.sample(s, uvColor).rg);
float yAlpha = textureY.sample(textureSamplerNearest, alphaTexCoord).r;
// 映射 Alpha 范围 float3 rgb = cvtMat.matrix * (yuv + cvtMat.offset);
#define ALPHA_MIN 0.1
#define ALPHA_MAX 0.9
float finalAlpha = saturate((yAlpha - ALPHA_MIN) / (ALPHA_MAX - ALPHA_MIN));
return float4(rgb, finalAlpha); // ───── 2.2 取 α ─────
} float alpha;
float2 uvAlpha = float2(in.textureCoordinate.x * split,
in.textureCoordinate.y);
float3 yuvA = float3(textureY.sample(s, uvAlpha).r,
textureUV.sample(s, uvAlpha).rg);
// 只要 Y 分量即可;若素材 α 经过和颜色相同的编码流程,可再走一次矩阵
alpha = (cvtMat.matrix * (yuvA + cvtMat.offset)).r;
return float4(rgb, alpha);
}
...@@ -160,8 +160,8 @@ NSString *const BDAlphaPlayerErrorDomain = @"BDAlphaPlayerErrorDomain"; ...@@ -160,8 +160,8 @@ NSString *const BDAlphaPlayerErrorDomain = @"BDAlphaPlayerErrorDomain";
CGRect tt = CGRectMake(0, 0, 0, 0); CGRect tt = CGRectMake(0, 0, 0, 0);
CGFloat width = superViewFrame.size.width; CGFloat width = superViewFrame.size.width;
CGFloat height = superViewFrame.size.height; CGFloat height = superViewFrame.size.height;
tt.origin.x = (openglNewRect.origin.x + 1) * width / 2; tt.origin.x = superViewFrame.origin.x + (openglNewRect.origin.x + 1) * width / 2;
tt.origin.y = height/2 - ceil((openglNewRect.origin.y + openglNewRect.size.height) * height / 2); tt.origin.y = superViewFrame.origin.y + height/2 - ceil((openglNewRect.origin.y + openglNewRect.size.height) * height / 2);
tt.size.width = openglNewRect.size.width / 2 * width; tt.size.width = openglNewRect.size.width / 2 * width;
tt.size.height = openglNewRect.size.height / 2 * height; tt.size.height = openglNewRect.size.height / 2 * height;
return tt; return tt;
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
"scale" : "1x" "scale" : "1x"
}, },
{ {
"filename" : "Share_icon_chat@2x.png", "filename" : "私信@2x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "2x" "scale" : "2x"
}, },
{ {
"filename" : "Share_icon_chat@3x.png", "filename" : "私信@3x.png",
"idiom" : "universal", "idiom" : "universal",
"scale" : "3x" "scale" : "3x"
} }
......
...@@ -15,10 +15,19 @@ ...@@ -15,10 +15,19 @@
- (void)fus_playMotorAudioIfNeeded{ - (void)fus_playMotorAudioIfNeeded{
if ([self fus_needPlayAudio]) { if ([self fus_needPlayAudio]) {
NSString *filePath = @"";
if ([[FUSGiftDataCenter sharedCenter] fus_checkGiftResourceExitWithURL:self.audioresource resourceMD5:nil]) { if ([NSString isNullWithString:self.mp4Res]) {
NSString *filePath = [FUSConfig.sharedInstanced.pathConfigs downloadResourcePath:self.audioresource pathMd5:nil]; if ([[FUSGiftDataCenter sharedCenter] fus_checkGiftResourceExitWithURL:self.audioresource resourceMD5:nil]) {
filePath = [FUSConfig.sharedInstanced.pathConfigs downloadResourcePath:self.audioresource pathMd5:nil];
}
} else {
filePath = [FUSConfig.sharedInstanced.pathConfigs downloadResourcePath:self.mp4Res pathMd5:self.mp4Md5];
}
if ([NSString isNullWithString:filePath] == NO) {
[[FUSAudioHelper shareInstance] stop]; [[FUSAudioHelper shareInstance] stop];
[[FUSAudioHelper shareInstance] playWithFilePath:[NSURL URLWithString:filePath] progress:^(NSTimeInterval currentTime) { [[FUSAudioHelper shareInstance] playWithFilePath:[NSURL URLWithString:filePath] progress:^(NSTimeInterval currentTime) {
......
...@@ -82,9 +82,9 @@ ...@@ -82,9 +82,9 @@
#define ROOM_CID_LIKE 11003 // 点赞 #define ROOM_CID_LIKE 11003 // 点赞
#define ROOM_CID_LIVE_STATU 11004 // 直播状态改变 #define ROOM_CID_LIVE_STATU 11004 // 直播状态改变
#define ROOM_CID_RECOMMEND_ANCHOR_LIVE_STATU 11005 // 推荐的主播直播状态 #define ROOM_CID_RECOMMEND_ANCHOR_LIVE_STATU 11005 // 推荐的主播直播状态
#define ROOM_CID_LIVE_SCOPE_DID_CHANGED 11017 // 切换直播范围
#define ROOM_CID_LIVE_ROOM_TYPE_CHANGED 11009 // 切换直播类型 #define ROOM_CID_LIVE_ROOM_TYPE_CHANGED 11009 // 切换直播类型
#define ROOM_CID_BECOME_FANS_GROUP_MEMBER 11010 // 用户成为粉丝团成员 #define ROOM_CID_BECOME_FANS_GROUP_MEMBER 11010 // 用户成为粉丝团成员
#define ROOM_CID_LIVE_SCOPE_DID_CHANGED 11017 // 切换直播范围
#define ROOM_CID_RoomPopularChanged 11019 // 人气值变化消息 #define ROOM_CID_RoomPopularChanged 11019 // 人气值变化消息
#define ROOM_CID_receivePatAudience 11025 // 接收撩一撩信息的cid #define ROOM_CID_receivePatAudience 11025 // 接收撩一撩信息的cid
#define ROOM_CID_receiveAnchorRewardChanged 11200 // fusi直播奖励数据变化 #define ROOM_CID_receiveAnchorRewardChanged 11200 // fusi直播奖励数据变化
......
...@@ -710,4 +710,12 @@ unzipRelativePath:(NSString * _Nonnull)unzipRelativePath ...@@ -710,4 +710,12 @@ unzipRelativePath:(NSString * _Nonnull)unzipRelativePath
unzipPath:(NSString *)unzipPath unzipPath:(NSString *)unzipPath
succeed:(void(^)(BOOL succeed))succeed; succeed:(void(^)(BOOL succeed))succeed;
/**
递归逐层解析 JSON 字典数据,只针对包含需要特殊解码的中文数据
@param obj 需要解析的数据,接收包括 NSArray、NSDictionary 数据
@return 解析完成的数据,NSArray 解析成 NSArray,NSDictionary 解析成 NSDictionary
*/
+ (id)fus_parseJSONDictionaryLayerByLayerWithObject:(id)obj;
@end @end
...@@ -1414,6 +1414,7 @@ ...@@ -1414,6 +1414,7 @@
BEF678162C6B156600A670FB /* live_treasure_box_bg_img.png in Resources */ = {isa = PBXBuildFile; fileRef = BEF675EE2C6B156500A670FB /* live_treasure_box_bg_img.png */; }; BEF678162C6B156600A670FB /* live_treasure_box_bg_img.png in Resources */ = {isa = PBXBuildFile; fileRef = BEF675EE2C6B156500A670FB /* live_treasure_box_bg_img.png */; };
BEF678172C6B156600A670FB /* live_userinfo_level_secrect.png in Resources */ = {isa = PBXBuildFile; fileRef = BEF675EF2C6B156500A670FB /* live_userinfo_level_secrect.png */; }; BEF678172C6B156600A670FB /* live_userinfo_level_secrect.png in Resources */ = {isa = PBXBuildFile; fileRef = BEF675EF2C6B156500A670FB /* live_userinfo_level_secrect.png */; };
C50E4ED36D48026661F4283F /* Pods_FUSShowRoomModule.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B8B2CC1956F16144828BF43D /* Pods_FUSShowRoomModule.framework */; }; C50E4ED36D48026661F4283F /* Pods_FUSShowRoomModule.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B8B2CC1956F16144828BF43D /* Pods_FUSShowRoomModule.framework */; };
D210F35F2E0AB4F900C41733 /* live_password_room_anim.mp4 in Resources */ = {isa = PBXBuildFile; fileRef = D210F35E2E0AB4F900C41733 /* live_password_room_anim.mp4 */; };
D2C6D57E2DFAB63200FB58E0 /* FUSLiveStartSetPasswordView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2C6D57D2DFAB63200FB58E0 /* FUSLiveStartSetPasswordView.swift */; }; D2C6D57E2DFAB63200FB58E0 /* FUSLiveStartSetPasswordView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2C6D57D2DFAB63200FB58E0 /* FUSLiveStartSetPasswordView.swift */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
...@@ -2831,6 +2832,7 @@ ...@@ -2831,6 +2832,7 @@
BEF675ED2C6B156500A670FB /* live_pk_background_image.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = live_pk_background_image.png; sourceTree = "<group>"; }; BEF675ED2C6B156500A670FB /* live_pk_background_image.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = live_pk_background_image.png; sourceTree = "<group>"; };
BEF675EE2C6B156500A670FB /* live_treasure_box_bg_img.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = live_treasure_box_bg_img.png; sourceTree = "<group>"; }; BEF675EE2C6B156500A670FB /* live_treasure_box_bg_img.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = live_treasure_box_bg_img.png; sourceTree = "<group>"; };
BEF675EF2C6B156500A670FB /* live_userinfo_level_secrect.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = live_userinfo_level_secrect.png; sourceTree = "<group>"; }; BEF675EF2C6B156500A670FB /* live_userinfo_level_secrect.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = live_userinfo_level_secrect.png; sourceTree = "<group>"; };
D210F35E2E0AB4F900C41733 /* live_password_room_anim.mp4 */ = {isa = PBXFileReference; lastKnownFileType = file; path = live_password_room_anim.mp4; sourceTree = "<group>"; };
D2C6D57D2DFAB63200FB58E0 /* FUSLiveStartSetPasswordView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FUSLiveStartSetPasswordView.swift; sourceTree = "<group>"; }; D2C6D57D2DFAB63200FB58E0 /* FUSLiveStartSetPasswordView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FUSLiveStartSetPasswordView.swift; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
...@@ -5282,6 +5284,7 @@ ...@@ -5282,6 +5284,7 @@
BEF675A22C6B156500A670FB /* Anims */ = { BEF675A22C6B156500A670FB /* Anims */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
D210F35E2E0AB4F900C41733 /* live_password_room_anim.mp4 */,
00A66C322CCA21F500F366E9 /* PK_Cover_Animation */, 00A66C322CCA21F500F366E9 /* PK_Cover_Animation */,
BEF675EA2C6B156500A670FB /* welcomeEnterRoom */, BEF675EA2C6B156500A670FB /* welcomeEnterRoom */,
BEF675DC2C6B156500A670FB /* Live_minimize_bg_anim */, BEF675DC2C6B156500A670FB /* Live_minimize_bg_anim */,
...@@ -6078,6 +6081,7 @@ ...@@ -6078,6 +6081,7 @@
BEF677E62C6B156600A670FB /* live_link_micro_request_7.png in Resources */, BEF677E62C6B156600A670FB /* live_link_micro_request_7.png in Resources */,
00A66C442CCA21F600F366E9 /* PK_Cover_Animation_18.png in Resources */, 00A66C442CCA21F600F366E9 /* PK_Cover_Animation_18.png in Resources */,
BEF676772C6B156600A670FB /* live_gift_item_selected_anim_7@2x.png in Resources */, BEF676772C6B156600A670FB /* live_gift_item_selected_anim_7@2x.png in Resources */,
D210F35F2E0AB4F900C41733 /* live_password_room_anim.mp4 in Resources */,
BEF676072C6B156500A670FB /* 1_First_Kill_Animation_23@3x.png in Resources */, BEF676072C6B156500A670FB /* 1_First_Kill_Animation_23@3x.png in Resources */,
BEF6772D2C6B156600A670FB /* PK_Progress_Bar_Light_Spot_Animation_12@2x.png in Resources */, BEF6772D2C6B156600A670FB /* PK_Progress_Bar_Light_Spot_Animation_12@2x.png in Resources */,
BEF676812C6B156600A670FB /* live_gift_item_selected_anim_17@2x.png in Resources */, BEF676812C6B156600A670FB /* live_gift_item_selected_anim_17@2x.png in Resources */,
......
...@@ -130,8 +130,13 @@ ...@@ -130,8 +130,13 @@
FUSSocketMessageModel *messageModel = notification.object; FUSSocketMessageModel *messageModel = notification.object;
NSDictionary *dict = [messageModel fus_getJsonDict]; NSDictionary *dict = [messageModel fus_getJsonDict];
NSString *roomId = dict[@"roomId"]; NSString *roomId = dict[@"roomId"];
if (roomId.integerValue == self.roomInfoModel.roomId.integerValue) { if (roomId.integerValue == self.roomInfoModel.roomId.integerValue) {
NSDictionary *encryptionData = [FUSHttpHelper fus_parseJSONDictionaryLayerByLayerWithObject:dict[@"encryptionData"]];
[self.roomInfoModel.encryptionData fus_setValueWithDict:encryptionData];
NSInteger liveScope = [dict[@"mode"] integerValue]; NSInteger liveScope = [dict[@"mode"] integerValue];
self.roomScopeType = liveScope == 1 ? FUSLiveRoomScopeTypePassword : FUSLiveRoomScopeTypeOpen; self.roomScopeType = liveScope == 1 ? FUSLiveRoomScopeTypePassword : FUSLiveRoomScopeTypeOpen;
} }
...@@ -1223,6 +1228,7 @@ ...@@ -1223,6 +1228,7 @@
} else { } else {
[self.liveVC fus_hidePasswordBlurView]; [self.liveVC fus_hidePasswordBlurView];
[self.currentFunctionView fus_showPasswordAnim];
[self.roomInfoModel fus_setValueWithDict:roomInfo]; [self.roomInfoModel fus_setValueWithDict:roomInfo];
self.roomInfoModel.reminderKeys = reminderKey; self.roomInfoModel.reminderKeys = reminderKey;
[self.currentFunctionView.chatTableView fus_addEnterRoomSystemTipMessage]; [self.currentFunctionView.chatTableView fus_addEnterRoomSystemTipMessage];
...@@ -1738,6 +1744,9 @@ ...@@ -1738,6 +1744,9 @@
#pragma mark - setter #pragma mark - setter
- (void)setRoomScopeType:(FUSLiveRoomScopeType)roomScopeType { - (void)setRoomScopeType:(FUSLiveRoomScopeType)roomScopeType {
if (_roomScopeType == roomScopeType) {
return;
}
_roomScopeType = roomScopeType; _roomScopeType = roomScopeType;
if (self.currentFunctionView) { if (self.currentFunctionView) {
[self.currentFunctionView fus_updateRoomScoreType]; [self.currentFunctionView fus_updateRoomScoreType];
......
...@@ -2226,6 +2226,10 @@ ...@@ -2226,6 +2226,10 @@
NSDictionary *params = @{@"fid":@(fid),@"cancel":@(cancel),@"password":password}; NSDictionary *params = @{@"fid":@(fid),@"cancel":@(cancel),@"password":password};
[FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_LIVE_CHANGE_Password params:params success:^(NSDictionary *dataDict, int code) { [FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_LIVE_CHANGE_Password params:params success:^(NSDictionary *dataDict, int code) {
if (cancel == 0) {
[FUSLiveHelper shareInstance].roomInfoModel.encryptionData.password = password;
}
[[FUSLiveHelper shareInstance].currentFunctionView fus_startRecordLiveTimeWithTime:dataDict[@"livetime"]]; [[FUSLiveHelper shareInstance].currentFunctionView fus_startRecordLiveTimeWithTime:dataDict[@"livetime"]];
if (success) { if (success) {
success(); success();
......
...@@ -239,6 +239,12 @@ ...@@ -239,6 +239,12 @@
[weakToolView removeFromSuperview]; [weakToolView removeFromSuperview];
[weakSelf removeFromSuperview]; [weakSelf removeFromSuperview];
if (type == FUSLiveBottomToolTypePK) { if (type == FUSLiveBottomToolTypePK) {
if (FUSLiveHelper.shareInstance.roomScopeType == FUSLiveRoomScopeTypePassword) {
[FUSDialogView fus_showDialog:[NSString fus_versionLocalString:@"仅公开屋可分享"]];
return;
}
if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(fus_bottomSubViewDidClickPKBtn:livePkBtnState:)]) { if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(fus_bottomSubViewDidClickPKBtn:livePkBtnState:)]) {
[weakSelf.delegate fus_bottomSubViewDidClickPKBtn:weakSelf livePkBtnState:weakSelf.pkBtnState]; [weakSelf.delegate fus_bottomSubViewDidClickPKBtn:weakSelf livePkBtnState:weakSelf.pkBtnState];
} }
...@@ -309,6 +315,12 @@ ...@@ -309,6 +315,12 @@
// 点击分享按钮 // 点击分享按钮
- (void)onClickShareBtn - (void)onClickShareBtn
{ {
if (FUSLiveHelper.shareInstance.liveType != FUSLiveTypeAnchor
&& FUSLiveHelper.shareInstance.roomScopeType == FUSLiveRoomScopeTypePassword) {
[FUSDialogView fus_showDialog:[NSString fus_versionLocalString:@"无法分享私享屋"]];
return;
}
if (!_bgView) { if (!_bgView) {
_bgView = [[FUSLiveHelper shareInstance].currentFunctionView fus_viewWithLayer:FUSLiveFunctionLayerManualPopView]; _bgView = [[FUSLiveHelper shareInstance].currentFunctionView fus_viewWithLayer:FUSLiveFunctionLayerManualPopView];
} }
......
...@@ -148,18 +148,10 @@ ...@@ -148,18 +148,10 @@
[self initBtnsWithTypes:_allBtnTypes]; [self initBtnsWithTypes:_allBtnTypes];
}else{ }else{
if (FUSLiveHelper.shareInstance.roomScopeType == FUSLiveRoomScopeTypePassword) { _allBtnTypes = [NSMutableArray arrayWithArray:@[@(FUSLiveBottomToolTypeAudienceMessage),
_allBtnTypes = [NSMutableArray arrayWithArray:@[@(FUSLiveBottomToolTypeAudienceMessage), @(FUSLiveBottomToolTypeTool),
@(FUSLiveBottomToolTypeTool), @(FUSLiveBottomToolTypeShare),
// @(FUSLiveBottomToolTypeShare), @(FUSLiveBottomToolTypeGift)]];
@(FUSLiveBottomToolTypeGift)]];
} else {
_allBtnTypes = [NSMutableArray arrayWithArray:@[@(FUSLiveBottomToolTypeAudienceMessage),
@(FUSLiveBottomToolTypeTool),
@(FUSLiveBottomToolTypeShare),
@(FUSLiveBottomToolTypeGift)]];
}
[self initBtnsWithTypes:_allBtnTypes]; [self initBtnsWithTypes:_allBtnTypes];
} }
...@@ -548,11 +540,7 @@ ...@@ -548,11 +540,7 @@
[self.roomScopeBtn setImage:image forState:UIControlStateNormal]; [self.roomScopeBtn setImage:image forState:UIControlStateNormal];
} else { } else {
if (FUSLiveHelper.shareInstance.roomScopeType == FUSLiveRoomScopeTypePassword) { [self fus_insertBtnWithType:FUSLiveBottomToolTypeShare index:self.divisionBtnType];
[self fus_removeBtnWithType:FUSLiveBottomToolTypeShare];
} else {
[self fus_insertBtnWithType:FUSLiveBottomToolTypeShare index:self.divisionBtnType];
}
[self fus_layoutBtnFrame]; [self fus_layoutBtnFrame];
} }
} }
...@@ -689,11 +677,7 @@ ...@@ -689,11 +677,7 @@
lastIndex = FUSLiveBottomToolTypeRoomScope; lastIndex = FUSLiveBottomToolTypeRoomScope;
} }
} else { } else {
if (FUSLiveHelper.shareInstance.roomScopeType == FUSLiveRoomScopeTypePassword) { lastIndex = FUSLiveBottomToolTypeShare;
lastIndex = FUSLiveBottomToolTypeTool;
} else {
lastIndex = FUSLiveBottomToolTypeShare;
}
} }
} }
...@@ -773,11 +757,7 @@ ...@@ -773,11 +757,7 @@
lastIndex = FUSLiveBottomToolTypeRoomScope; lastIndex = FUSLiveBottomToolTypeRoomScope;
} }
} else { } else {
if (FUSLiveHelper.shareInstance.roomScopeType == FUSLiveRoomScopeTypePassword) { lastIndex = FUSLiveBottomToolTypeShare;
lastIndex = FUSLiveBottomToolTypeTool;
} else {
lastIndex = FUSLiveBottomToolTypeShare;
}
} }
[self fus_insertBtnWithType:FUSLiveBottomToolTypeInteractionGameEntrance [self fus_insertBtnWithType:FUSLiveBottomToolTypeInteractionGameEntrance
index:[self.allBtnTypes indexOfObject:@(lastIndex)]+1]; index:[self.allBtnTypes indexOfObject:@(lastIndex)]+1];
...@@ -804,12 +784,7 @@ ...@@ -804,12 +784,7 @@
_divisionBtnType = FUSLiveBottomToolTypeRoomScope; _divisionBtnType = FUSLiveBottomToolTypeRoomScope;
} }
}else{ }else{
_divisionBtnType = FUSLiveBottomToolTypeShare;
if (FUSLiveHelper.shareInstance.roomScopeType == FUSLiveRoomScopeTypePassword) {
_divisionBtnType = FUSLiveBottomToolTypeTool;
} else {
_divisionBtnType = FUSLiveBottomToolTypeShare;
}
} }
} }
...@@ -983,18 +958,10 @@ ...@@ -983,18 +958,10 @@
} }
} else { } else {
if (FUSLiveHelper.shareInstance.roomScopeType == FUSLiveRoomScopeTypePassword) { _allBtnTypes = [NSMutableArray arrayWithArray:@[@(FUSLiveBottomToolTypeAudienceMessage),
_allBtnTypes = [NSMutableArray arrayWithArray:@[@(FUSLiveBottomToolTypeAudienceMessage), @(FUSLiveBottomToolTypeTool),
@(FUSLiveBottomToolTypeTool), @(FUSLiveBottomToolTypeShare),
// @(FUSLiveBottomToolTypeShare), @(FUSLiveBottomToolTypeGift)]];
@(FUSLiveBottomToolTypeGift)]];
} else {
_allBtnTypes = [NSMutableArray arrayWithArray:@[@(FUSLiveBottomToolTypeAudienceMessage),
@(FUSLiveBottomToolTypeTool),
@(FUSLiveBottomToolTypeShare),
@(FUSLiveBottomToolTypeGift)]];
}
} }
[self.chatTextView resetBulletsSelected]; [self.chatTextView resetBulletsSelected];
self.chatTextView.textView.text = nil; self.chatTextView.textView.text = nil;
......
...@@ -254,6 +254,8 @@ typedef NS_ENUM(NSInteger, FUSFunctionMode) { ...@@ -254,6 +254,8 @@ typedef NS_ENUM(NSInteger, FUSFunctionMode) {
/// 更新直播间范围 /// 更新直播间范围
- (void)fus_updateRoomScoreType; - (void)fus_updateRoomScoreType;
- (void)fus_showPasswordAnim;
- (void)fus_setAnchorAudioClose:(BOOL)closed; - (void)fus_setAnchorAudioClose:(BOOL)closed;
/** /**
......
...@@ -88,6 +88,7 @@ ...@@ -88,6 +88,7 @@
#import "FSRShowRoomEffectRecommondViewController.h" #import "FSRShowRoomEffectRecommondViewController.h"
#import <MediaPlayer/MediaPlayer.h> #import <MediaPlayer/MediaPlayer.h>
#import <FUSBDAlphaPlayer/BDAlphaPlayer.h>
#import "FUSAudiencePopView.h" #import "FUSAudiencePopView.h"
#import "FUSPopularProgressView.h" #import "FUSPopularProgressView.h"
...@@ -107,7 +108,8 @@ UIScrollViewDelegate, ...@@ -107,7 +108,8 @@ UIScrollViewDelegate,
FUSLiveChatInputViewDelegate, FUSLiveChatInputViewDelegate,
FUSPKHelperDeleagte, FUSPKHelperDeleagte,
FUSLinkMicUserListDelegate, FUSLinkMicUserListDelegate,
UIGestureRecognizerDelegate UIGestureRecognizerDelegate,
BDAlphaPlayerMetalViewDelegate
> >
#pragma mark - View Property #pragma mark - View Property
...@@ -170,7 +172,7 @@ UIGestureRecognizerDelegate ...@@ -170,7 +172,7 @@ UIGestureRecognizerDelegate
@property (nonatomic, strong) UIView *bulletsOriginalView; @property (nonatomic, strong) UIView *bulletsOriginalView;
///显示座驾的view ///显示座驾的view
@property (nonatomic, strong) FUSCarEnterView *carEnterView; @property (nonatomic, weak) FUSCarEnterView *carEnterView;
/** /**
主播模式 HeaderView 主播模式 HeaderView
...@@ -335,6 +337,9 @@ UIGestureRecognizerDelegate ...@@ -335,6 +337,9 @@ UIGestureRecognizerDelegate
@property (nonatomic, strong) UIImageView *passwordRoomIconImageView; @property (nonatomic, strong) UIImageView *passwordRoomIconImageView;
@property (nonatomic, strong) BDAlphaPlayerMetalView *passwordAnimPlayView;
@end @end
@implementation FUSLiveFunctionView @implementation FUSLiveFunctionView
...@@ -576,6 +581,7 @@ UIGestureRecognizerDelegate ...@@ -576,6 +581,7 @@ UIGestureRecognizerDelegate
*/ */
- (void)initActivtiyView - (void)initActivtiyView
{ {
if (FUSConfig.sharedInstanced.devConfigs.appStatus) { if (FUSConfig.sharedInstanced.devConfigs.appStatus) {
return; return;
} }
...@@ -2048,6 +2054,7 @@ UIGestureRecognizerDelegate ...@@ -2048,6 +2054,7 @@ UIGestureRecognizerDelegate
*/ */
- (void)registerNotification - (void)registerNotification
{ {
// 首先移除已有通知, 防止重复注册 // 首先移除已有通知, 防止重复注册
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
...@@ -2446,7 +2453,8 @@ UIGestureRecognizerDelegate ...@@ -2446,7 +2453,8 @@ UIGestureRecognizerDelegate
// 有资源文件,使用 webp View 显示 // 有资源文件,使用 webp View 显示
weakSelf.carEnterView = nil; weakSelf.carEnterView = nil;
weakSelf.carEnterView = [[FUSCarEnterView alloc] initWithFrame:UIView.fus_screenFrame]; FUSCarEnterView *carEnterView = [[FUSCarEnterView alloc] initWithFrame:UIView.fus_screenFrame];
weakSelf.carEnterView = carEnterView;
weakSelf.carEnterView.hidden = NO; weakSelf.carEnterView.hidden = NO;
weakSelf.carEnterView.userInteractionEnabled = NO; weakSelf.carEnterView.userInteractionEnabled = NO;
...@@ -2458,7 +2466,6 @@ UIGestureRecognizerDelegate ...@@ -2458,7 +2466,6 @@ UIGestureRecognizerDelegate
[weakSelf.carEnterView setAnimationDidEnd:^(UIView *animatingView) { [weakSelf.carEnterView setAnimationDidEnd:^(UIView *animatingView) {
[animatingView removeFromSuperview]; [animatingView removeFromSuperview];
weakSelf.carEnterView = nil;
}]; }];
[weakSelf.carEnterView setTapContentHandler:^(FUSRoomUserInfoModel * _Nonnull model) { [weakSelf.carEnterView setTapContentHandler:^(FUSRoomUserInfoModel * _Nonnull model) {
...@@ -4734,6 +4741,10 @@ UIGestureRecognizerDelegate ...@@ -4734,6 +4741,10 @@ UIGestureRecognizerDelegate
[self.passwordRoomIconImageView removeFromSuperview]; [self.passwordRoomIconImageView removeFromSuperview];
self.passwordRoomIconImageView = nil; self.passwordRoomIconImageView = nil;
[self.passwordAnimPlayView stop];
[self.passwordAnimPlayView removeFromSuperview];
self.passwordAnimPlayView = nil;
[self.chatFastInputView fus_endTimer]; [self.chatFastInputView fus_endTimer];
[self.chatFastInputView removeFromSuperview]; [self.chatFastInputView removeFromSuperview];
self.chatFastInputView = nil; self.chatFastInputView = nil;
...@@ -5811,13 +5822,33 @@ UIGestureRecognizerDelegate ...@@ -5811,13 +5822,33 @@ UIGestureRecognizerDelegate
- (void)fus_showPasswordAnim { - (void)fus_showPasswordAnim {
[self.passwordRoomIconImageView removeFromSuperview]; if (self.passwordRoomIconImageView.superview) {
return;
}
self.passwordRoomIconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(12, self.popularView.bottom + 10, 49, 49)]; self.passwordRoomIconImageView = [[UIImageView alloc] initWithFrame:CGRectMake(12, self.popularView.bottom + 10, 49, 49)];
self.passwordRoomIconImageView.centerX = self.popularView.centerX; self.passwordRoomIconImageView.centerX = self.popularView.centerX;
self.passwordRoomIconImageView.image = [FUSShowRoomCenterBunble imageNamed:@"live_room_password_room_icon"]; self.passwordRoomIconImageView.image = [FUSShowRoomCenterBunble imageNamed:@"live_room_password_room_icon"];
[[self fus_viewWithLayer:FUSLiveFunctionLayerRoomInfos] addSubview:self.passwordRoomIconImageView]; [[self fus_viewWithLayer:FUSLiveFunctionLayerRoomInfos] addSubview:self.passwordRoomIconImageView];
[self.passwordAnimPlayView stop];
[self.passwordAnimPlayView removeFromSuperview];
self.passwordAnimPlayView = nil;
self.passwordAnimPlayView = [[BDAlphaPlayerMetalView alloc] initWithDelegate:self];
self.passwordAnimPlayView.frame = UIView.fus_screenFrame;
self.passwordAnimPlayView.contentMode = UIViewContentModeScaleToFill;
self.passwordAnimPlayView.backgroundColor = [UIColor clearColor];
[FUSLiveHelper.shareInstance.currentLiveVCView addSubview:self.passwordAnimPlayView];
NSString *animPath = [[FUSShowRoomCenterBunble bundle] pathForResource:@"live_password_room_anim" ofType:@"mp4"];
BDAlphaPlayerMetalConfiguration *configuration = [BDAlphaPlayerMetalConfiguration defaultConfiguration];
configuration.directory = animPath;
configuration.renderSuperViewFrame = UIView.fus_screenFrame;
configuration.orientation = BDAlphaPlayerOrientationPortrait;
[self.passwordAnimPlayView playWithMetalConfiguration:configuration];
} }
- (void)fus_setAnchorAudioClose:(BOOL)closed { - (void)fus_setAnchorAudioClose:(BOOL)closed {
...@@ -6065,6 +6096,18 @@ UIGestureRecognizerDelegate ...@@ -6065,6 +6096,18 @@ UIGestureRecognizerDelegate
} }
} }
#pragma mark - BDAlphaPlayerMetalViewDelegate
- (void)metalView:(BDAlphaPlayerMetalView *)metalView didFinishPlayingWithError:(NSError *)error {
[UIView animateWithDuration:.35 animations:^{
self.passwordAnimPlayView.alpha = 0;
} completion:^(BOOL finished) {
[self.passwordAnimPlayView removeFromSuperview];
self.passwordAnimPlayView = nil;
}];
}
#pragma mark - Emitter Delegate #pragma mark - Emitter Delegate
- (nullable FUSEmitterViewCell *)cellForEmitterView:(nonnull FUSEmitterView *)emitterView - (nullable FUSEmitterViewCell *)cellForEmitterView:(nonnull FUSEmitterView *)emitterView
{ {
......
...@@ -134,6 +134,7 @@ ...@@ -134,6 +134,7 @@
} }
- (void)dealloc{ - (void)dealloc{
FUSLogInfo(@"%s",__func__);
[[FUSKeyboardShowHelper sharedInstance] removeDelegate:self]; [[FUSKeyboardShowHelper sharedInstance] removeDelegate:self];
} }
...@@ -206,7 +207,8 @@ ...@@ -206,7 +207,8 @@
BDAlphaPlayerMetalConfiguration *configuration = [BDAlphaPlayerMetalConfiguration defaultConfiguration]; BDAlphaPlayerMetalConfiguration *configuration = [BDAlphaPlayerMetalConfiguration defaultConfiguration];
configuration.directory = filePath; configuration.directory = filePath;
configuration.renderSuperViewFrame = UIView.fus_screenFrame; CGRect renderSuperViewFrame = weakSelf.playView.frame;
configuration.renderSuperViewFrame = renderSuperViewFrame;
configuration.orientation = BDAlphaPlayerOrientationPortrait; configuration.orientation = BDAlphaPlayerOrientationPortrait;
[weakSelf.playView playWithMetalConfiguration:configuration]; [weakSelf.playView playWithMetalConfiguration:configuration];
...@@ -237,9 +239,8 @@ ...@@ -237,9 +239,8 @@
CGRect keyboardFrame = [FUSKeyboardShowHelper sharedInstance].keyboardFrame; CGRect keyboardFrame = [FUSKeyboardShowHelper sharedInstance].keyboardFrame;
[self fus_restContentYWithKeyboardFrame:keyboardFrame withAnimate:NO]; [self fus_restContentYWithKeyboardFrame:keyboardFrame withAnimate:NO];
} }
if ([NSString isNullWithString:self.motorModel.mp4Res]) {
[self.motorModel fus_playMotorAudioIfNeeded]; [self.motorModel fus_playMotorAudioIfNeeded];
}
_carImageView.alpha = 0; _carImageView.alpha = 0;
...@@ -304,6 +305,7 @@ ...@@ -304,6 +305,7 @@
[self.playView stopWithFinishPlayingCallback]; [self.playView stopWithFinishPlayingCallback];
self.playView.hidden = YES; self.playView.hidden = YES;
self.playView = nil;
[self removeAllSubviews]; [self removeAllSubviews];
_animationDidEnd = nil; _animationDidEnd = nil;
......
...@@ -163,7 +163,7 @@ import RxSwift ...@@ -163,7 +163,7 @@ import RxSwift
let newPassword = self.passwordView.fus_getText() let newPassword = self.passwordView.fus_getText()
if newPassword.count < 4 { if newPassword.count < 4 {
FUSDialogView.fus_showDialog(.fus_versionLocalString("私享屋密码必须为4位")) FUSDialogView.fus_showDialog(.fus_versionLocalString("密码设置错误"))
} else { } else {
if self.isAudience { if self.isAudience {
......
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