Parcourir la source

更新SDK 方法

Steven il y a 1 an
Parent
commit
1bc858b07e

+ 1 - 1
KulexiuForStudent/KulexiuForStudent.xcodeproj/xcshareddata/xcschemes/KulexiuForStudent.xcscheme

@@ -51,7 +51,7 @@
       </Testables>
    </TestAction>
    <LaunchAction
-      buildConfiguration = "TEST"
+      buildConfiguration = "Debug"
       selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
       selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
       launchStyle = "0"

+ 13 - 0
KulexiuForStudent/KulexiuForStudent/Module/TXClassRoom/Controller/TXClassroomViewController.m

@@ -117,6 +117,18 @@
 
 @implementation TXClassroomViewController
 
+- (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator {
+    [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
+    [coordinator animateAlongsideTransition:nil completion:^(id<UIViewControllerTransitionCoordinatorContext>  _Nonnull context) {
+        if (size.width > size.height) {
+            [TRTC_MANAGER refreshGSMode];
+        }
+    }];
+}
+- (BOOL)prefersHomeIndicatorAutoHidden {
+    return YES;
+}
+
 - (void)changeOrientation:(BOOL)isLandScape {
     if (isLandScape) {
         // 切换到横屏
@@ -140,6 +152,7 @@
     }
 }
 
+
 #pragma mark - Life cycle
 
 - (void)viewWillAppear:(BOOL)animated {

+ 3 - 0
KulexiuForStudent/KulexiuForStudent/Module/TXClassRoom/Service/TRTC/TXRTCService.h

@@ -36,6 +36,9 @@ NS_ASSUME_NONNULL_BEGIN
 
 + (instancetype)shareInstance;
 
+// 刷新publish重力感应模式
+- (void)refreshGSMode;
+
 - (void)setting3AParmWithANS:(NSInteger)ANS AEC:(NSInteger)AEC AGC:(NSInteger)AGC;
 
 - (void)config3AWithANS:(NSInteger)ANS AEC:(NSInteger)AEC AGC:(NSInteger)AGC;

+ 8 - 4
KulexiuForStudent/KulexiuForStudent/Module/TXClassRoom/Service/TRTC/TXRTCService.m

@@ -42,6 +42,11 @@
     return service;
 }
 
+- (void)refreshGSMode {
+    
+    [[TRTCCloud sharedInstance] setGravitySensorAdaptiveMode:TRTCGravitySensorAdaptiveMode_Disable];
+}
+
 - (void)defaultAudioSetting {
     self.ANS = 0;
     self.AEC = 100;
@@ -70,7 +75,7 @@
         self.error = error;
     }
     [[TRTCCloud sharedInstance] enterRoom:[self getTRTCRoomConfig:roomId] appScene:TRTCAppSceneVideoCall];
-    [TRTCCloud sharedInstance].delegate = self;
+    [[TRTCCloud sharedInstance] addDelegate:self];
     [self configDefaultHardwareStatus];
 //    [self configAAudio];
 }
@@ -91,7 +96,8 @@
         self.success = callback;
     }
     [[TRTCCloud sharedInstance] exitRoom];
-    [TRTCCloud destroySharedIntance];
+    [[TRTCCloud sharedInstance] removeDelegate:self]; // 移除代理
+    [TRTCCloud destroySharedInstance];
     if (callback) {
         callback(1);
     }
@@ -112,8 +118,6 @@
     videoEncParams.resMode = TRTCVideoResolutionModeLandscape;
     videoEncParams.videoResolution = TRTCVideoResolution_640_480;
     [[TRTCCloud sharedInstance] setVideoEncoderParam:videoEncParams];
-    [[TRTCCloud sharedInstance] setGSensorMode:TRTCGSensorMode_UIFixLayout];
-//    [[TRTCCloud sharedInstance] setVideoMuteImage:[self generalCloseImage] fps:5];
     [self config3AWithANS:self.ANS AEC:self.AEC AGC:self.AGC];
 }
 

+ 5 - 4
KulexiuForStudent/KulexiuForStudent/Module/TXLive/Controller/TXLiveRoomViewController.m

@@ -460,7 +460,7 @@ static int clickPraiseBtnTimes  = 0;
             [self.trtcCloud stopLocalAudio];
             [self.trtcCloud exitRoom];
             _trtcCloud = nil;
-            [TRTCCloud destroySharedIntance];
+            [TRTCCloud destroySharedInstance];
         }
         self.micStatus = MICSTATUS_NOMAL;
         self.isTransferRole = NO;
@@ -1161,7 +1161,7 @@ static int clickPraiseBtnTimes  = 0;
     parms.role = TRTCRoleAnchor;
     parms.strRoomId = self.roomId;
     parms.userId = UserDefault(IM_USERID);
-    self.trtcCloud.delegate = self;
+    [self.trtcCloud addDelegate:self];
     [self config3AParams];
     [self configVideoAndAudioSetting];
     [self.trtcCloud enterRoom:parms appScene:TRTCAppSceneLIVE];
@@ -1838,7 +1838,7 @@ static int clickPraiseBtnTimes  = 0;
 - (TRTCCloud *)trtcCloud {
     if (!_trtcCloud) {
         _trtcCloud = [TRTCCloud sharedInstance];
-        _trtcCloud.delegate = self;
+        [_trtcCloud addDelegate:self];
     }
     return _trtcCloud;
 }
@@ -2448,8 +2448,9 @@ static int clickPraiseBtnTimes  = 0;
         [self.trtcCloud stopAllRemoteView];
         [self.trtcCloud stopLocalAudio];
         [self.trtcCloud exitRoom];
+        [self.trtcCloud removeDelegate:self];
         _trtcCloud = nil;
-        [TRTCCloud destroySharedIntance];
+        [TRTCCloud destroySharedInstance];
     }
 }