webRtcPlayerViewController+AppDelegate.m 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. //
  2. // webRtcPlayerViewController+AppDelegate.m
  3. // 双子星云手机
  4. //
  5. // Created by xd h on 2024/9/18.
  6. //
  7. #import "webRtcPlayerViewController+AppDelegate.h"
  8. @implementation webRtcPlayerViewController (AppDelegate)
  9. #pragma mark - UIApplication Delegate
  10. - (void)applicationWillResignActive:(NSNotification *)notification
  11. {
  12. //HLog(@"11111");
  13. }
  14. - (void)applicationDidEnterBackground:(NSNotification *)notification {
  15. // app进入后台时
  16. [self pauseStream];
  17. [self checkLanAndPrivacyModeTypeFun];
  18. }
  19. - (void)applicationDidBecomeActive:(NSNotification *)notification
  20. {
  21. if(!ksharedAppDelegate.isDidShowPwdType){
  22. [self resumeStream];
  23. }
  24. }
  25. - (void)applicationWillTerminate:(UIApplication *)application {
  26. // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
  27. [self.mediaStream disconnect];
  28. }
  29. #pragma mark 云机停止拉流
  30. - (void)pauseStream
  31. {
  32. [self.mediaStream pauseStream];
  33. }
  34. #pragma mark 云机唤醒拉流
  35. - (void)resumeStream
  36. {
  37. [self.mediaStream resumeStream];
  38. }
  39. #pragma mark 检测是否为横屏而且 隐私模式 (密码界面只有竖屏 UI会乱)
  40. - (void)checkLanAndPrivacyModeTypeFun
  41. {
  42. if(!self->isLan){
  43. return;
  44. }
  45. if(!ksharedAppDelegate.DeviceThirdIdMod.data.isPrivacyMode){
  46. return;
  47. }
  48. self->isLan = YES;
  49. self->isLanAndPrivacyEnterBackground = YES;
  50. //旋转屏幕为竖屏 (已经在sceneDelegate 处理旋转)
  51. HLog(@"旋转屏幕为竖屏 (已经在sceneDelegate 处理旋转)")
  52. }
  53. #pragma mark 输入密码完成
  54. - (void)didInpuPwdOkFun
  55. {
  56. [self resumeStream];
  57. if(self->isLanAndPrivacyEnterBackground){
  58. self->isLanAndPrivacyEnterBackground = NO;
  59. ksharedAppDelegate.supportScreenRotateType = YES;
  60. [self hx_rotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight];
  61. HLog(@"旋转屏幕为横屏")
  62. }
  63. }
  64. @end