网易云从集成到多人视频会议(2)~中间的坑~~

配置

   //记得先倒入头文件#import 
   //网易云
    NSString *appKey        = @"your appKey";
    NIMSDKOption *option    = [NIMSDKOption optionWithAppKey:appKey];
    //option.apnsCername      = @"your APNs cer name";
    //option.pkCername        = @"your pushkit cer name";
    [[NIMSDK sharedSDK] registerWithOption:option];
    [[NIMSDKConfig sharedConfig] setupSDKDir:@"your data path"];

登录

 //1.account  就账号  2.token  可以现在官网有个api调试,获取token
[[[NIMSDK sharedSDK] loginManager] login:account token:token completion:^(NSError *error) {
        if (error == nil){
            NSLog(@"登陆网易云成功");
        }else{
            NSLog(@"登陆网易云失败");
        }
    }];

接下来就是预订会议(相当于创建房间,根据roomid)

预订会议

    NIMNetCallMeeting *meeting = [[NIMNetCallMeeting alloc] init];
    meeting.name = roomId;//不能重复
    meeting.type = NIMNetCallMediaTypeVideo;//类型
    meeting.ext = @"哈哈哈哈";//扩展信息
    meeting.actor = YES; //这个必须为yes,否则可能不会显示本地画面
    [[NIMAVChatSDK sharedSDK].netCallManager reserveMeeting:meeting completion:^(NIMNetCallMeeting * _Nonnull meeting, NSError * _Nonnull error) {
        if (!error) {
            NSLog(@"预定成功 ,加入会议");
        }else{
                NSLog(@"预定房间失败");
        }
    }];

加入会议

(特别注意这个:demo上是


网易云从集成到多人视频会议(2)~中间的坑~~_第1张图片
C812B935-DA8E-4B9F-A7F8-AC7B965DDB9F.png

这两个方法一直搞不清然后(demo是进入聊天室,现在是进入会议)坑。。。

 NIMNetCallOption *callOption =[[NIMNetCallOption alloc]init];
    // 发送视频质量(SDK会处理 有可能无效)
    //callOption.preferredVideoQuality =NIMNetCallVideoQualityDefault;
    // 禁止剪裁
    // callOption.disableVideoCropping =NO;
    // 自动旋转远端画面
    callOption.autoRotateRemoteVideo =YES;
    // 期望的视频编码器
    callOption.preferredVideoEncoder =NIMNetCallVideoCodecDefault;
    // 期望的视频解码器
    callOption.preferredVideoDecoder =NIMNetCallVideoCodecDefault;
    // 初始打开摄像头,
    callOption.videoCaptureParam.startWithCameraOn =YES;
    // 启用互动直播
    callOption.enableBypassStreaming =YES;
    // 互动直播推流地址
    callOption.bypassStreamingUrl =nil;
    // 是否在服务器录制音频
    callOption.serverRecordAudio =YES;
    callOption.autoDeactivateAudioSession = NO;
    // 是否在服务器录制视频
    callOption.serverRecordVideo =YES;
    callOption.videoCaptureParam = [self videoCaptureParam];
    // 加入会议的类型->音频/视频
    rMeeting.type =NIMNetCallMediaTypeVideo;
    // 是否发送音视频数据
    rMeeting.actor = YES;
    // 网路电话配置
    rMeeting.option = callOption;
    //进入房间聊天
    [[NIMAVChatSDK sharedSDK].netCallManager joinMeeting:rMeeting completion:^(NIMNetCallMeeting * _Nonnull meeting, NSError * _Nonnull error) {
        if (!error) {
            NSLog(@"进入成功");
            NSLog(@"callID====%llu---name===--%@",meeting.callID,meeting.name);
        } else {
            NSLog(@"进入失败");
        }
    }];

//音视频配置
- (NIMNetCallVideoCaptureParam *)videoCaptureParam{
    NIMNetCallVideoCaptureParam *param = [[NIMNetCallVideoCaptureParam alloc] init];
    param.videoCrop = [[NTESBundleSetting sharedConfig] videochatVideoCrop];
    // 使用后置摄像头开始视频, 默认是 YES
    param.startWithBackCamera   = [[NTESBundleSetting sharedConfig] startWithBackCamera];
    param.preferredVideoQuality = [[NTESBundleSetting sharedConfig] preferredVideoQuality];
    param.provideLocalVideoProcess = [[NTESBundleSetting sharedConfig] provideLocalProcess];
    param.preferredVideoQuality = NIMNetCallVideoQualityLow;
    return param;
}

下一篇 ( 显示本地视频流,,和远程视频流)

你可能感兴趣的:(网易云从集成到多人视频会议(2)~中间的坑~~)