Commit 82deddd4 by suolong

添加liveData

parent 216be65d
Showing with 103 additions and 30 deletions
......@@ -610,7 +610,7 @@
3E261EA82F2C5FAB0008C0C0 /* FUSLinkMicMediator.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E261EA62F2C5FAB0008C0C0 /* FUSLinkMicMediator.m */; };
3E261EB02F2CA6890008C0C0 /* FUSLinkMicStreamConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = 3E261EAE2F2CA6890008C0C0 /* FUSLinkMicStreamConfig.h */; };
3E261EB12F2CA6890008C0C0 /* FUSLinkMicStreamConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = 3E261EAF2F2CA6890008C0C0 /* FUSLinkMicStreamConfig.m */; };
3EB9FDF42F52E33000E83A08 /* FUSLiveRTCData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3EB9FDF32F52E33000E83A08 /* FUSLiveRTCData.swift */; };
3E50054E2F556DC300058145 /* FUSLiveRTCData.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3E50054D2F556DC300058145 /* FUSLiveRTCData.swift */; };
BE189D972C733B450008418B /* FSRActiveModel.h in Headers */ = {isa = PBXBuildFile; fileRef = BE189CE52C733B450008418B /* FSRActiveModel.h */; };
BE189D982C733B450008418B /* FSRActiveModel.m in Sources */ = {isa = PBXBuildFile; fileRef = BE189CE62C733B450008418B /* FSRActiveModel.m */; };
BE189D992C733B450008418B /* FSRActiveMotorEffectModel.h in Headers */ = {isa = PBXBuildFile; fileRef = BE189CE72C733B450008418B /* FSRActiveMotorEffectModel.h */; };
......@@ -2478,7 +2478,7 @@
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>"; };
3E261EAF2F2CA6890008C0C0 /* FUSLinkMicStreamConfig.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = FUSLinkMicStreamConfig.m; sourceTree = "<group>"; };
3EB9FDF32F52E33000E83A08 /* 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>"; };
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>"; };
B8B2CC1956F16144828BF43D /* Pods_FUSShowRoomModule.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_FUSShowRoomModule.framework; sourceTree = BUILT_PRODUCTS_DIR; };
......@@ -4981,6 +4981,7 @@
BED6557E2C5B745D00668116 /* Model */ = {
isa = PBXGroup;
children = (
3E50054D2F556DC300058145 /* FUSLiveRTCData.swift */,
00B28CB42D2FC0520008476B /* FUSAssessQualityInfoModel.h */,
00B28CB52D2FC0520008476B /* FUSAssessQualityInfoModel.m */,
00B28C992D2FBF3E0008476B /* FUSLiveEndModel.h */,
......@@ -5028,7 +5029,6 @@
BECF744F2D30C7BF00F5ABBC /* FUSBeforeLiveCondModel.m */,
00E6CD8F2F52FA3900B63797 /* FUSLiveChatTableClickTypeRangeModel.h */,
00E6CD902F52FA3900B63797 /* FUSLiveChatTableClickTypeRangeModel.m */,
3EB9FDF32F52E33000E83A08 /* FUSLiveRTCData.swift */,
);
path = Model;
sourceTree = "<group>";
......@@ -8495,14 +8495,10 @@
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-FUSShowRoomModule/Pods-FUSShowRoomModule-resources-${CONFIGURATION}-input-files.xcfilelist",
);
inputPaths = (
);
name = "[CP] Copy Pods Resources";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-FUSShowRoomModule/Pods-FUSShowRoomModule-resources-${CONFIGURATION}-output-files.xcfilelist",
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-FUSShowRoomModule/Pods-FUSShowRoomModule-resources.sh\"\n";
......@@ -8871,9 +8867,9 @@
BED65A382C5B745F00668116 /* FUSTreasureBoxGrabDetailModel.m in Sources */,
BED659E72C5B745F00668116 /* FUSPKHotAnchorListTableViewCell.m in Sources */,
BED659052C5B745E00668116 /* FUSLiveChatInputMenuView.m in Sources */,
3E50054E2F556DC300058145 /* FUSLiveRTCData.swift in Sources */,
BED65AC12C5B745F00668116 /* FUSHomeNovaListViewController.m in Sources */,
BED6587C2C5B745E00668116 /* FUSLiveParcelGiftModel.m in Sources */,
3EB9FDF42F52E33000E83A08 /* FUSLiveRTCData.swift in Sources */,
BED659032C5B745E00668116 /* FUSLiveChatInputHelper.m in Sources */,
BE189E1E2C733B460008418B /* FSRGuarddictActiveView.m in Sources */,
BED659A62C5B745F00668116 /* FUSLinkMicroUserListView.m in Sources */,
......
......@@ -48,7 +48,7 @@ static NSString *const kEndVChatNotification = @"endVChatNotification";
- (void)fus_initial {
self.isCell = YES;
//TODO: 索隆 - V57
// 视讯开始
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(fus_recieveStartIMVideoChat:) name:kStartVChatNotification object:nil];
//// // 视讯结束
......
......@@ -461,9 +461,10 @@ typedef NS_ENUM(NSInteger, FUSStreamState) {
switch (FUSLiveHelper.shareInstance.liveType) {
case FUSLiveTypeAnchor:
{
// FUSLiveHelper.shareInstance.livePushConfig.captureSDKType = FUSLiveHelper.shareInstance.rtcType == 1 ? FUSStreamCaptureSDKTypeTTSDK : FUSSingleChatRTCTypeByteRTC;
FUSLiveHelper.shareInstance.livePushConfig.captureSDKType = FUSLiveHelper.shareInstance.liveRTCData.rtcType == 1 ? FUSStreamCaptureSDKTypeTTSDK : FUSSingleChatRTCTypeByteRTC;
// 搭建主播端推流 View
_streamView = [[FUSLiveStreamView alloc] initPushViewWithFrame:self.contentView.bounds pushConfig:FUSLiveHelper.shareInstance.livePushConfig];
[_streamView.pushView.captureHelper fus_updateChannelId:FUSLiveHelper.shareInstance.roomInfoModel.roomId roomId:FUSLiveHelper.shareInstance.roomInfoModel.roomId token:FUSLiveHelper.shareInstance.liveRTCData.rtcToken];
[FUSLiveHelper shareInstance].liveRoomType = FUSRoomTypeLive;
__weak typeof(self) weakSelf = self;
_streamView.pushView.captureHelper.sessionErrorHandler = ^(NSInteger errorCode) {
......@@ -485,8 +486,8 @@ typedef NS_ENUM(NSInteger, FUSStreamState) {
if ([NSUserDefaults fus_readCurrentUserObjectWithKey:FUSLiveUDKeys.fus_UD_KEY_liveMirrorOpened]) {
BOOL mirror = [[NSUserDefaults fus_readCurrentUserObjectWithKey:FUSLiveUDKeys.fus_UD_KEY_liveMirrorOpened] boolValue];
//TODO: 索隆 - V57
// _streamView.pushView.captureHelper.videoMirror = mirror;
_streamView.pushView.captureHelper.videoMirror = mirror;
}
[_contentView addSubview:_streamView];
......@@ -635,8 +636,8 @@ typedef NS_ENUM(NSInteger, FUSStreamState) {
_pushView = _streamView.pushView;
// 调用推拉流 View 开始推流
__weak typeof(self) weakSelf = self;
//TODO: 索隆 - V57 mixurl没有
[_streamView.pushView fus_startPushWithURL:[FUSLiveHelper shareInstance].streamModel.url andMixUrl:@"" success:^{
[_streamView.pushView fus_startPushWithURL:[FUSLiveHelper shareInstance].streamModel.url andMixUrl:[FUSLiveHelper shareInstance].streamModel.mixUrl success:^{
//服务器启动推流
[FUSLiveHttpHelper fus_startPushStreamWithRoomId:[[[FUSLiveHelper shareInstance] roomInfoModel] roomId] vdoid:[[[FUSLiveHelper shareInstance] streamModel] vdoid] livingWay:@"0" liveScope:[FUSLiveHelper shareInstance].roomScopeType success:^(NSDictionary *dict){
......
......@@ -46,12 +46,12 @@ import SwiftyJSON
/// 有效期时间戳
@objc public var expireTimeInterval:Int = 0
@objc public func ff_hasExpire() -> Bool {
@objc public func fus_hasExpire() -> Bool {
// 排除1分钟的误差
return (expireTime - Int(Date().timeIntervalSince1970)) > 60
}
public static func createFromArchieve(key: String) -> FUSLiveRTCData? {
@objc public static func createFromArchieve(key: String) -> FUSLiveRTCData? {
if let dict = FUSCustomizedInfosStore.fus_readCommonInfos(withKey: key) as? [String: AnyHashable] {
return self.createFrom(JSON(dict))
......@@ -59,7 +59,11 @@ import SwiftyJSON
return nil
}
public func ff_cacheToArchieve(key:String) {
@objc public static func getDataTurnModel(key: [String: AnyHashable]) -> FUSLiveRTCData? {
return self.createFrom(JSON(key))
}
@objc public func fus_cacheToArchieve(key:String) {
var dict: [String: AnyHashable] = .init()
......
......@@ -15,7 +15,7 @@
@property (nonatomic, strong) NSString *ip; // 包房ip
@property (nonatomic, strong) NSString *port; // 包房端口
@property (nonatomic, strong) NSString *url; // 推流地址/观看地址
@property (nonatomic, strong) NSString *mixUrl; // Mix推流地址/观看地址
// 推流相关
@property (nonatomic, strong) NSString *fr; // 帧率
@property (nonatomic, strong) NSString *vbr; // 视频码率
......
......@@ -10,6 +10,10 @@
@implementation FUSStreamModel
+ (NSDictionary<NSString *,id> *)modelCustomPropertyMapper
{
return @{@"mixUrl":@"urlNew"};
}
/*
@property (nonatomic, strong) NSString *fr; // 帧率
......
......@@ -18,9 +18,8 @@
#import "FUSRoomQuickChatListModel.h"
#import "FUSBaoFangAnchorModel.h"
#import "FUSLiveBeforeReadyModel.h"
//#import <FUSShowRoomModule/FUSShowRoomModule-Swift.h>
@class FUSLiveRTCData;
@class FUSLiveRTCData;
typedef enum : NSInteger {
defaultRoom = 0
} RoomType;
......
......@@ -31,6 +31,8 @@
#import "FUSLivePunishmentManager.h"
static NSString *const KLiveDataCenter_store_liveRTCData = @"LiveDataCenter_store_liveRTCData";
@interface FUSLiveHelper ()
@property (nonatomic, strong) UINavigationController *navLive;
......@@ -94,11 +96,35 @@
}
[self registerNotification];
[self getRTCData];
}
return self;
}
#pragma mark - 获取rtcData
- (void)getRTCData
{
[FUSLiveHttpHelper fus_requestliveGetRTCData:[FUSLiveHelper shareInstance].roomInfoModel.roomId Success:^(NSDictionary * _Nonnull dataDict) {
if (FUSLiveHelper.shareInstance.liveRTCData == nil) {
FUSLiveHelper.shareInstance.liveRTCData = [FUSLiveRTCData createFromArchieveWithKey:KLiveDataCenter_store_liveRTCData];
}
if ([FUSLiveHelper.shareInstance.liveRTCData fus_hasExpire] == true) {
FUSLiveRTCData *data = [FUSLiveRTCData getDataTurnModelWithKey:dataDict];
FUSLiveHelper.shareInstance.liveRTCData = data;
[data fus_cacheToArchieveWithKey:KLiveDataCenter_store_liveRTCData];
}
}failure:^(NSString * _Nonnull msg, int code) {
FUSLogError(@"获取rtcData失败:%@",msg);
}];
}
#pragma mark - Notification
/**
注册通知
......
......@@ -154,6 +154,15 @@ NS_ASSUME_NONNULL_BEGIN
liveScope:(NSInteger)liveScope
success:(void(^)(NSDictionary *dataDict))success
failure:(void(^)(NSString *, int))failure;
/**
* 获取直播连麦RTC
* @param roomId roomId
* @param success 成功回调
* @param failure 失败回调
*/
+ (void)fus_requestliveGetRTCData:(NSString *)roomId
Success:(void(^)(NSDictionary *dataDict))success
failure:(void (^)(NSString *msg, int code))failure;
/**
更新直播状态
......
......@@ -661,6 +661,8 @@
}
+ (void)fus_requestChangeRoomType:(NSString *)roomType
fid:(NSString *)fid
success:(void (^)(NSDictionary *dataDict))success
......@@ -682,7 +684,34 @@
if (failure) failure(FAILURE_MESSAGE, code);
}];
}
#pragma mark - 获取直播连麦RTC
/**
* 获取直播连麦RTC
* @param roomId roomId
* @param success 成功回调
* @param failure 失败回调
*/
+ (void)fus_requestliveGetRTCData:(NSString *)roomId
Success:(void(^)(NSDictionary *dataDict))success
failure:(void (^)(NSString *msg, int code))failure;
{
if ([NSString isNull:roomId]) {
if (failure) failure(nil, ERROR_CODE);
return;
}
NSDictionary *params = @{@"roomId":roomId};
[FUSHttpHelper postRequestBinaryWithUrl:FUSShowRoomURLs.fus_URL_GET_RTCData params:params success:^(NSDictionary *dataDict, int code) {
if (success) success(dataDict);
} failure:^(NSDictionary *dataDict, int code) {
if (failure) failure(FAILURE_MESSAGE, code);
}];
}
#pragma mark - 活动相关
/**
* 包房中获取活动数据(海外版2.0.0丢弃该方法,换用requestActivitiesWithRoomId:success:failure:)
......
......@@ -4276,7 +4276,6 @@ BDAlphaPlayerMetalViewDelegate
// weakSelf.pusherChatTableView.contentInset = UIEdgeInsetsMake(0, 0, 0, 0);
// }
// });
// //TODO: 索隆 - V57
//// [liveVC fus_getLiveStreamView].showBGImageView = NO;
// if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(fus_liveFunctionViewPkViewDidRemoved:)]) {
// [weakSelf.delegate fus_liveFunctionViewPkViewDidRemoved:weakSelf];
......@@ -4488,7 +4487,6 @@ BDAlphaPlayerMetalViewDelegate
// }
// });
//
// //TODO: 索隆 - V57
//// [liveVC fus_getLiveStreamView].showBGImageView = YES;
// if (weakSelf.delegate && [weakSelf.delegate respondsToSelector:@selector(fus_liveFunctionViewPkViewDidRemoved:)]) {
// [weakSelf.delegate fus_liveFunctionViewPkViewDidRemoved:weakSelf];
......
......@@ -8,6 +8,7 @@
#import "FUSLinkMicMediator.h"
#import "FUSByteHelper.h"
#import "FUSLiveHelper.h"
#import <FUSShowRoomModule/FUSShowRoomModule-Swift.h>
// 通知常量赋值(与原常量一致)
NSString * const kFUSLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
......@@ -145,12 +146,12 @@ NSString * const kFUSLiveLinkMicRoleDidChanged = @"linkMicRoleChange";
[self.byteHelper.captureHelper fus_joinRoomWIthRoomId:roomId completionHandler:success];
}else
{
//TODO: 索隆 - V57
// [self.byteHelper fus_joinChannelWithToken:FUSLiveHelper.shareInstance.liveRTCData.rtcToken
// ChannelId:roomId
// uid:[NSString stringWithFormat:@"%ld", uid]
// success:success
// failure:failure];
[self.byteHelper fus_joinChannelWithToken:FUSLiveHelper.shareInstance.liveRTCData.rtcToken
ChannelId:roomId
uid:[NSString stringWithFormat:@"%ld", uid]
success:success
failure:failure];
}
}else
{
......
......@@ -479,7 +479,6 @@ NSString * const kStreamPKPlayViewLiveStateNotification = @"kStreamPKPlayViewLiv
if (onceMore.integerValue == 0) {
[FUSLiveHelper shareInstance].currentPushView.streamType = FUSStreamTypeRTC;
[FUSLiveHelper shareInstance].liveRoomType = FUSRoomTypePK;
//TODO: 索隆 - V57
// [[FUSLiveHelper shareInstance].currentPushView fus_startRTCStreamingWithURL:[FUSLiveHelper shareInstance].roomInfoModel.publishUrl channelID:_channelId success:^{
//
//// FUSLogInfo(@"------->连麦推流失败");
......
......@@ -114,7 +114,8 @@ NS_ASSUME_NONNULL_BEGIN
// 启动推流直播
+ (NSString *)fus_URL_START_PUSH;
// 获取直播连麦RTC
+ (NSString *)fus_URL_GET_RTCData;
// 获取包房在线用户
+ (NSString *)fus_URL_LIVE_ONLINE_USERS;
......
......@@ -194,6 +194,12 @@
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/live/liveStarted.html"];
}
// 获取直播连麦RTC
+ (NSString *)fus_URL_GET_RTCData
{
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/live/rtcdata/get"];
}
// 获取包房在线用户
+ (NSString *)fus_URL_LIVE_ONLINE_USERS {
return [FUSConfig.sharedInstanced.pathConfigs apiUrl:@"/live/getRoomOnlineUser.html"];
......
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