Browse Source

1.app后台停止拉流

huangxiaodong 2 years ago
parent
commit
cefa809c39

+ 11 - 1
创维盒子/双子星云手机/CloudPlayer/PlayerViewController+AppDelegate.m

@@ -60,6 +60,9 @@
 
         [currentVC dismissViewControllerAnimated:NO completion:nil];
     }
+    
+    self.needToDissconnectType = YES;
+    [self disconnectVideoServer];
 }
 
 - (void)applicationDidBecomeActive:(NSNotification *)notification
@@ -82,7 +85,14 @@
         return;
     }
     
-    [self requestIFrame];
+    if(self.needToDissconnectType){
+        self.needToDissconnectType = NO;
+        [self tryAgain];
+    }
+    else{
+        [self requestIFrame];
+    }
+    
     
     [self setShowImgAndVoiceTypeFun:YES];
 }

+ 2 - 0
创维盒子/双子星云手机/CloudPlayer/PlayerViewController.h

@@ -90,6 +90,8 @@
 //第一次链接设备 要发送指令信息 实现单点登录
 @property (nonatomic, assign)BOOL isLoginAgainType;
 
+//主动断开链接  后台之类的
+@property (nonatomic, assign)BOOL needToDissconnectType;
 
 //上传文件用到
 @property (nonatomic, copy) NSString * _Nullable taskUid;

+ 1 - 1
创维盒子/双子星云手机/CloudPlayer/PlayerViewController.mm

@@ -2686,7 +2686,7 @@ static int  couneeee = 0;
         HLog(@"云手机未连接成功");
     }else if (timeDiff >= 30) { // 30s 无渲染数据
         
-        if(!_isLoginAgainType && [self isPlayerViewIsTopVCFun]){
+        if(!_needToDissconnectType && !_isLoginAgainType && [self isPlayerViewIsTopVCFun]){
              HLog(@"云手机30s 无渲染数据 自动断开连接");
              self.concentTime = [iTools getNowTimeStamp];