Commit cd7b8e58 by MissYasiky

修改 iOS 初始化方法

parent e936bc8a
......@@ -43,59 +43,29 @@ NSString * NSStringFromErrorCode(PolyvCloudClassErrorCode code) {
RCT_EXPORT_MODULE();
/* 初始化
// 参数 appId (必填)
// 参数 appSecret (必填)
// 参数 userId(必填)
// 参数 channelId(必填)
// 初始化
// 参数 vodKey (选填)
// 参数 decodeKey (选填)
// 参数 decodeIv(选填)
// 参数 viewerId(选填)
// 参数 nickName(选填)
RCT_EXPORT_METHOD(
init:(NSString *)appId
appSecret:(NSString *)appSecret
userId:(NSString *)userId
channelId:(NSString *)channelId
init:(NSString *)vodKey
decodeKey:(NSString *)decodeKey
decodeIv:(NSString *)decodeIv
viewerId:(NSString *)viewerId
nickName:(NSString *)nickName
findEventsWithResolver:(RCTPromiseResolveBlock)resolve
rejecter:(RCTPromiseRejectBlock)reject
)
{
NSLog(@"init() - %@ 、 %@ 、 %@ 、 %@ 、 %@、 %@", appId, appSecret, channelId, userId, viewerId, nickName);
RCTLogInfo(@"init() - %@ 、 %@ 、 %@ 、 %@、 %@、 %@", appId, appSecret, channelId, userId, viewerId, nickName);
NSLog(@"init() - %@ 、 %@ 、 %@ 、 %@ 、 %@", vodKey, decodeKey, decodeIv, viewerId, nickName);
RCTLogInfo(@"init() - %@ 、 %@ 、 %@ 、 %@、 %@", vodKey, decodeKey, decodeIv, viewerId, nickName);
PolyvCloudClassErrorCode errorCode = PolyvCloudClassError_Success;
if (!appId.length) {
errorCode = PolyvCloudClassError_NoAppId;
} else if (!appSecret.length) {
errorCode = PolyvCloudClassError_NoAppSecret;
} else if (!userId.length) {
errorCode = PolyvCloudClassError_NoUserId;
} else if (!channelId.length) {
errorCode = PolyvCloudClassError_NoChannelId;
}
if (errorCode == PolyvCloudClassError_Success) {
/// 以下的直播字符串参数在官网(https://live.polyv.net/#/develop/appId)上已配置好
PLVLiveVideoConfig *liveConfig = [PLVLiveVideoConfig sharedInstance];
liveConfig.appId = appId;
liveConfig.appSecret = appSecret;
liveConfig.userId = userId;
liveConfig.channelId = channelId;
// 配置统计后台参数:用户Id、用户昵称及自定义参数
[PLVLiveVideoConfig setViewLogParam:viewerId param2:nickName param4:nil param5:nil];
resolve(@[@(PolyvCloudClassError_Success)]);
} else {
NSString *errorDesc = NSStringFromErrorCode(errorCode);
NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:errorCode userInfo:@{NSLocalizedDescriptionKey:errorDesc}];
NSLog(@"%@", errorDesc);
reject([@(errorCode) stringValue], errorDesc, error);
}
// 配置统计后台参数:用户Id、用户昵称及自定义参数
[PLVLiveVideoConfig setViewLogParam:viewerId param2:nickName param4:nil param5:nil];
resolve(@[@(PolyvCloudClassError_Success)]);
}
*/
// 直播登录
// 参数 userId(必填)
......
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