Skip to content

Commit

Permalink
Merge pull request #29 from Dongshanxu/master
Browse files Browse the repository at this point in the history
发布2.1.0
  • Loading branch information
sunkeding authored Dec 10, 2021
2 parents 9ba2e45 + fc0c518 commit 4fa4e37
Show file tree
Hide file tree
Showing 59 changed files with 3,630 additions and 225 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,11 @@ class NERoomService: NERoomAPIService,NERoomServiceProtocol,NIMChatManagerDelega
completion?(nil, nil, NSError(domain: NELiveRoomErrorDomain, code: NELiveRoomErrorInvalidParams, userInfo: [NSLocalizedDescriptionKey: "uid不合法!!"]))
return
}
let ret = NERtcEngine.shared().joinChannel(withToken: self.currentUser?.checksum ?? "", channelName: cname, myUid: myUid) { (error, cid, elapesd) in
let ret = NERtcEngine.shared().joinChannel(withToken: self.currentUser?.checksum ?? "", channelName: cname, myUid: myUid) { (error, cid, elapesd,uid) in
dispatchGroup.leave()
rtcError = error as NSError?
}

if ret == 0 {
dispatchGroup.enter()
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class NESeatService: NESeatAPIService,NESeatServiceProtocol,NIMPassThroughManage
completion?(NSError(domain: NELiveRoomErrorDomain, code: NELiveRoomErrorInvalidResponse, userInfo: [NSLocalizedDescriptionKey: "uid不能为空!"]))
return
}
NERtcEngine.shared().joinChannel(withToken: NELiveRoom.shared.roomService.currentUser?.checksum ?? "", channelName: cname, myUid: uid ) { (error, cid, elapsed) in
NERtcEngine.shared().joinChannel(withToken: NELiveRoom.shared.roomService.currentUser?.checksum ?? "", channelName: cname, myUid: uid ) { (error, cid, elapsed,uid) in
completion?(error)
}
}
Expand Down Expand Up @@ -282,7 +282,7 @@ class NESeatService: NESeatAPIService,NESeatServiceProtocol,NIMPassThroughManage
let cname = NELiveRoom.shared.roomService.currentRoom?.cname ?? ""
let myUid = NELiveRoom.shared.roomService.currentUser?.uid ?? 0
let checksum = NELiveRoom.shared.roomService.currentUser?.checksum ?? ""
NERtcEngine.shared().joinChannel(withToken: checksum, channelName: cname, myUid: myUid) { (error, cid, elapsed) in
NERtcEngine.shared().joinChannel(withToken: checksum, channelName: cname, myUid: myUid) { (error, cid, elapsed,uid) in
completion?(error)
}
} else {
Expand Down
68 changes: 48 additions & 20 deletions OnlinePK-iOS/NLiteAVDemo.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

79 changes: 68 additions & 11 deletions OnlinePK-iOS/NLiteAVDemo/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,19 @@
#import "NETabbarController.h"
#import "NTELoginVC.h"
#import "AppKey.h"
#import "NEPkLiveAttachment.h"


@interface AppDelegate ()<UNUserNotificationCenterDelegate,NERtcEngineDelegate>
@end

@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[self initWindow];
[self setupLoginSDK];
[self setIQKeyboard];
setupLogger();
[self autoLogin];

return YES;
}

Expand All @@ -34,16 +37,9 @@ - (void)initWindow {

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor = UIColor.whiteColor;
if (![NSObject isNullOrNilWithObject:[NEAccount shared].accessToken]) {
NETabbarController *tabbarCtrl = [[NETabbarController alloc]init];
self.window.rootViewController = tabbarCtrl;
[NENavigator shared].navigationController = tabbarCtrl.menuNavController;
}else {
UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:[[NTELoginVC alloc] initWithOptions:nil isShowClose:YES]];
self.window.rootViewController = nav;
[NENavigator shared].loginNavigationController = nav;
}

NETabbarController *tabbarCtrl = [[NETabbarController alloc]init];
self.window.rootViewController = tabbarCtrl;
[NENavigator shared].navigationController = tabbarCtrl.menuNavController;
[self.window makeKeyAndVisible];

//设置麦位组件
Expand All @@ -53,6 +49,7 @@ - (void)initWindow {
}

- (void)autoLogin {

if ([[NEAccount shared].accessToken length] > 0) {
[NEAccount loginByTokenWithCompletion:^(NSDictionary * _Nullable data, NSError * _Nullable error) {
if (error) {
Expand All @@ -67,4 +64,64 @@ - (void)setIQKeyboard {
[IQKeyboardManager sharedManager].enableAutoToolbar = NO;
}

- (void)setupSDK {
NIMSDKOption *option = [NIMSDKOption optionWithAppKey:kAppKey];
[[NIMSDK sharedSDK] registerWithOption:option];
[NIMCustomObject registerCustomDecoder:[[NEPKLiveAttachmentDecoder alloc] init]];
}

- (void)setupLoginSDK {
YXConfig *config = [[YXConfig alloc] init];
config.appKey = kAppKey;
config.parentScope = [NSNumber numberWithInt:1];
config.scope = [NSNumber numberWithInt:3];
#ifdef DEBUG
config.isOnline = NO;
#else
config.isOnline = YES;
#endif
config.type = YXLoginEmail;

[[AuthorManager shareInstance] initAuthorWithConfig:config];
// __weak typeof(self) weakSelf = self;
if ([LoginManager canAutologin] == YES) {
[LoginManager autoLoginWithCompletion:^(YXUserInfo * _Nullable userinfo, NSError * _Nullable error) {
if (error == nil) {

NSLog(@"统一登录sdk登录成功");
[NEAccount syncLoginData:userinfo];
//[weakSelf imLogin];
}else {
[UIApplication.sharedApplication.keyWindow makeToast:error.localizedDescription];
}
}];
}else {
NSLog(@"LoginManager startEntrance");
/*
[LoginManager startLoginWithCompletion:^(YXUserInfo * _Nullable userinfo, NSError * _Nullable error) {
if (error == nil) {
NSLog(@"统一登录sdk登录成功");
[NEAccount syncLoginData:userinfo];
//[weakSelf imLogin];
}else {
[UIApplication.sharedApplication.keyWindow makeToast:error.localizedDescription];
}
}]; */

[LoginManager startEntranceWithCompletion:^(YXUserInfo * _Nullable userinfo, NSError * _Nullable error) {
if (error == nil) {
NSLog(@"统一登录sdk登录成功");
[NEAccount syncLoginData:userinfo];
//[weakSelf imLogin];
}else {
[UIApplication.sharedApplication.keyWindow makeToast:error.localizedDescription];
}
}];
}
}

- (void)imLogin{
[NEAccount imloginWithYXuser:[LoginManager getUserInfo]];
}

@end
10 changes: 5 additions & 5 deletions OnlinePK-iOS/NLiteAVDemo/AppKey.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@
#ifndef AppKey_h
#define AppKey_h

/// 线上 IM key
/// IM key
static NSString * const kAppKey = @"<#请输入NIMSDK appkey#>";
/// 线上 RTC key (同 IM key)
/// RTC key (同 IM key)
static NSString * const kNertcAppkey = @"<#请输入NSRtc appkey#>";
/// 线上服务器
static NSString * const kApiHost = @"<#请输入线上服务器地址#>";
/// 服务器地址
static NSString * const kApiHost = @"http://yiyong-ne-live.netease.im";

/// 数据收集
static NSString * const kApiDataHost = @"https://statistic.live.126.net";


#endif /* AppKey_h */
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"idiom" : "universal",
"scale" : "1x"
},
{
"filename" : "[email protected]",
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion OnlinePK-iOS/NLiteAVDemo/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,6 @@
<key>UIViewControllerBasedStatusBarAppearance</key>
<false/>
<key>kGitHashCode</key>
<string>10d8ed6</string>
<string>7f52703</string>
</dict>
</plist>
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,14 @@ NS_ASSUME_NONNULL_BEGIN

/// 连麦管理按钮点击事件
- (void)connectMicManagerClick;

/// 建立本地canvas模型
- (NERtcVideoCanvas *)setupLocalCanvas;
/// 建立单人直播canvas模型
- (NERtcVideoCanvas *)setupSingleCanvas;

//远端用户加入音视频房间回调
- (void)onUserJoinWithUid:(int64_t)userId;

//主播关闭房间
- (void)closeLiveRoom;
@end
Expand Down
Loading

0 comments on commit 4fa4e37

Please sign in to comment.