|
@@ -39,6 +39,7 @@
|
|
|
#import "MySetViewController.h"
|
|
|
#import "PhoneTimeInfoModel.h"
|
|
|
#import "connectDeviceManager.h"
|
|
|
+#import "ComontAlretViewController.h"
|
|
|
|
|
|
|
|
|
typedef enum : NSUInteger {
|
|
@@ -72,7 +73,8 @@ NSString *ipConnect;
|
|
|
RecoderManagerDelegate,
|
|
|
AudioRecoderMamagerDelegate,
|
|
|
RCLiveSteamManagerDelegate,
|
|
|
-UITextFieldDelegate>
|
|
|
+UITextFieldDelegate,
|
|
|
+ComontAlretViewControllerDelegate>
|
|
|
{
|
|
|
// __block int _ihandle;
|
|
|
|
|
@@ -136,6 +138,9 @@ UITextFieldDelegate>
|
|
|
|
|
|
@property (nonatomic, strong) NSTimer *checkThridConnectTimer; // 检查瑞云那边连接完成没
|
|
|
|
|
|
+//音频和图片是否可以刷新
|
|
|
+@property (nonatomic, assign) BOOL canShowImgAndVoiceType;
|
|
|
+@property (nonatomic, assign) BOOL isPwdVCShow;//当前是否有密码页面
|
|
|
@end
|
|
|
|
|
|
@implementation PlayerViewController
|
|
@@ -154,6 +159,9 @@ UITextFieldDelegate>
|
|
|
[self setNeedsUpdateOfHomeIndicatorAutoHidden];
|
|
|
}
|
|
|
canControl = YES;
|
|
|
+ _canShowImgAndVoiceType = NO;
|
|
|
+ _isPwdVCShow = NO;
|
|
|
+
|
|
|
//[self opencommandChannelManagerrc_openURL];
|
|
|
//[self openbusinessCommandChannelManagerrc_openURL];
|
|
|
|
|
@@ -250,6 +258,8 @@ UITextFieldDelegate>
|
|
|
[[UIApplication sharedApplication] setStatusBarHidden:YES];
|
|
|
|
|
|
[self setTimerCountDown];
|
|
|
+
|
|
|
+ [self setShowImgAndVoiceTypeFun:YES];
|
|
|
}
|
|
|
|
|
|
- (void)viewDidLayoutSubviews {
|
|
@@ -268,6 +278,8 @@ UITextFieldDelegate>
|
|
|
|
|
|
self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
|
|
|
[super viewWillDisappear:animated];
|
|
|
+
|
|
|
+ [self setShowImgAndVoiceTypeFun:NO];
|
|
|
}
|
|
|
|
|
|
// 退出控制器 回收资源
|
|
@@ -388,6 +400,8 @@ UITextFieldDelegate>
|
|
|
if (self.commandChannelManager.rc_socketStatus == RCSocketCloudPhoneStatusConnected){
|
|
|
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
|
|
|
+ [self fristConnectNeedGiveAMsgFun];
|
|
|
+
|
|
|
// /*获取自己的用户名(电话号码)*/
|
|
|
// NSString *selfUseName = nil;
|
|
|
// NSDictionary *dict111 = [[UseAccountManage shareInstance] getLoginInfo];
|
|
@@ -410,6 +424,7 @@ UITextFieldDelegate>
|
|
|
}
|
|
|
} receive:^(id message, FLSocketCloudPhoneReceiveType type) {
|
|
|
HLog(@"webSocket指令通道接收消息:------------------\n%@",message);
|
|
|
+
|
|
|
if([message isKindOfClass:[NSMutableString class]] || [message isKindOfClass:[NSString class]])
|
|
|
{
|
|
|
message = [(NSString *)message dataUsingEncoding:(NSUTF8StringEncoding)];
|
|
@@ -418,7 +433,11 @@ UITextFieldDelegate>
|
|
|
NSError *error = nil;
|
|
|
NSDictionary *dataDict = [NSJSONSerialization JSONObjectWithData:message options:NSJSONReadingMutableContainers error:&error];
|
|
|
|
|
|
- if([dataDict isKindOfClass:[NSDictionary class]]){
|
|
|
+ if(!dataDict){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(![dataDict isKindOfClass:[NSDictionary class]]){
|
|
|
//[__NSCFString allKeys] unrecognized selector sent to ins
|
|
|
return;
|
|
|
}
|
|
@@ -433,7 +452,17 @@ UITextFieldDelegate>
|
|
|
NSString *code = nil;
|
|
|
if ([[dataDict allKeys] containsObject:@"data"]) {
|
|
|
NSDictionary *data = dataDict[@"data"];
|
|
|
- if ([[data allKeys] containsObject:@"code"]) {
|
|
|
+
|
|
|
+ if([data isKindOfClass:[NSString class]]){
|
|
|
+ NSString * dataStr = (NSString*)data;
|
|
|
+ if([dataStr isEqualToString:@"offline_notification"]){
|
|
|
+ HLog(@"被别人挤下线了");
|
|
|
+ [self LogoutByOtherFun];
|
|
|
+ }
|
|
|
+
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ else if ([data isKindOfClass:[NSDictionary class]] && [[data allKeys] containsObject:@"code"]) {
|
|
|
code = [data objectForKey:@"code"];
|
|
|
|
|
|
if (![code isKindOfClass:[NSString class]]) {
|
|
@@ -954,6 +983,11 @@ UITextFieldDelegate>
|
|
|
#pragma mark - RCLiveSteamManagerDelegate
|
|
|
|
|
|
- (void)liveStreamManagerOutPut:(RCLiveSteamManager *)manager didOutPutVideoPixelBuffer:(CVPixelBufferRef)pixelBuffer {
|
|
|
+
|
|
|
+ if(!_canShowImgAndVoiceType){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (!mySelf || mySelf->haveBack) {
|
|
|
return;
|
|
|
}
|
|
@@ -1013,6 +1047,11 @@ UITextFieldDelegate>
|
|
|
|
|
|
- (void)liveStreamManagerOutPut:(RCLiveSteamManager *)manager didOutPutAudioData:(NSData *)pcmData {
|
|
|
@autoreleasepool {
|
|
|
+
|
|
|
+ if(!_canShowImgAndVoiceType){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
if (mySelf&&!(mySelf->haveBack)){
|
|
|
[mySelf->connectLock lock];
|
|
|
|
|
@@ -1425,6 +1464,75 @@ NSDate *lastVideoTome;/*上一帧数据时间*/
|
|
|
};
|
|
|
}
|
|
|
|
|
|
+#pragma mark 盒子第一次连接成功 给ws发送信息 单点登录 把其他账号挤下去
|
|
|
+bool didSendfristMsg = NO;
|
|
|
+- (void)fristConnectNeedGiveAMsgFun{
|
|
|
+ if(!didSendfristMsg){
|
|
|
+ NSString *commondStr = @"{\"type\":\"forwardMsg\",\"data\":\"offline_notification\"}";
|
|
|
+ [self send_data:commondStr];
|
|
|
+ didSendfristMsg = true;
|
|
|
+ //test code
|
|
|
+ //[self LogoutByOtherFun];
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 单点登录被挤下线弹框
|
|
|
+- (void)LogoutByOtherFun
|
|
|
+{
|
|
|
+ //测试用
|
|
|
+ //return;
|
|
|
+
|
|
|
+ _canShowImgAndVoiceType = NO;
|
|
|
+
|
|
|
+ //yyyy-MM-dd HH:mm:ss
|
|
|
+ NSString*dateStr = [iTools getNowTimeString2];
|
|
|
+ if(dateStr && dateStr.length == 19){
|
|
|
+ dateStr = [dateStr substringWithRange:NSMakeRange(11, 5)];
|
|
|
+ }
|
|
|
+
|
|
|
+ NSString *tipStr = [[NSString alloc] initWithFormat:@"%@%@%@",NSLocalizedString(@"single_sign_on_Tips_one",nil),dateStr,NSLocalizedString(@"single_sign_on_Tips_two",nil)];
|
|
|
+
|
|
|
+ /*弹窗提示重启*/
|
|
|
+ ComontAlretViewController *nextVC = [[ComontAlretViewController alloc] initWithTiTle:NSLocalizedString(@"single_sign_on_Tips_logout",nil)
|
|
|
+ msg:tipStr
|
|
|
+ cancelTitle:NSLocalizedString(@"single_sign_on_exit",nil)
|
|
|
+ okTitle:NSLocalizedString(@"single_sign_on_login_again",nil) isOkBtnHighlight:YES];
|
|
|
+ nextVC.modalPresentationStyle = UIModalPresentationCustom;
|
|
|
+ nextVC.delegate = self;
|
|
|
+ [self presentViewController:nextVC animated:YES completion:^{
|
|
|
+ nextVC.view.superview.backgroundColor = [UIColor clearColor];
|
|
|
+ }];
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 设置是否可以播放音频和视频
|
|
|
+-(void)setShowPwdVCTypeFun
|
|
|
+{
|
|
|
+ _isPwdVCShow = YES;
|
|
|
+}
|
|
|
+
|
|
|
+-(void)setShowImgAndVoiceTypeFun
|
|
|
+{
|
|
|
+ _isPwdVCShow = NO;
|
|
|
+ [self setShowImgAndVoiceTypeFun:YES];
|
|
|
+}
|
|
|
+
|
|
|
+-(void)setShowImgAndVoiceTypeFun:(bool)isCan
|
|
|
+{
|
|
|
+ if(isCan){//判断当前是否为最前面 才能播放
|
|
|
+ UIViewController*topVc = self.navigationController.viewControllers.lastObject;
|
|
|
+
|
|
|
+ if(_isPwdVCShow || ![topVc isKindOfClass:[PlayerViewController class]]){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ _canShowImgAndVoiceType = isCan;
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ _canShowImgAndVoiceType = isCan;
|
|
|
+ }
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
#pragma mark - PlayerControlViewDelegate---控制器按键
|
|
|
//- (void)stopShareBtnBePressed:(id)sender
|
|
|
//{
|
|
@@ -1754,6 +1862,10 @@ BOOL inReconnect = NO;
|
|
|
// 控制按钮收拾开始、结束
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerViewControlBtnTouchBegan) name:PlayerViewControlBtnTouchBeganNotification object:nil];
|
|
|
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(playerViewControlBtnTouchEnd) name:PlayerViewControlBtnTouchEndNotification object:nil];
|
|
|
+
|
|
|
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setShowImgAndVoiceTypeFun) name:ShowImgAndVoiceNotification object:nil];
|
|
|
+
|
|
|
+ [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(setShowPwdVCTypeFun) name:ShowPwdVCNotification object:nil];
|
|
|
}
|
|
|
|
|
|
- (void)removeNSNotification
|