PlayerViewController+otherDelegate.mm 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. //
  2. // PlayerViewController+otherDelegate.m
  3. // 隐私保护
  4. //
  5. // Created by xd h on 2023/10/13.
  6. //
  7. #import "PlayerViewController+otherDelegate.h"
  8. #import "RCCommandHelp.h"
  9. #import "couldPhoneBaseInfoModel.h"
  10. #import "cachesFileManager.h"
  11. #import "couldphoneSysInfoModel.h"
  12. #import "TvStatusModel.h"
  13. #import "HWVersionModel.h"
  14. #import <MJExtension.h>
  15. #import "HaveNewVersionView.h"
  16. #import "connectDeviceManager.h"
  17. #import "downloadManager.h"
  18. #import "uploadFileManager.h"
  19. #import "cloudPhoneExtraFileListModel.h"
  20. #import "AppDelegate.h"
  21. #import "cachesFileManager.h"
  22. #import "extraMediaEventModel.h"
  23. #import "USBInsertPopView.h"
  24. #import "commandSendCheckModel.h"
  25. @implementation PlayerViewController (otherDelegate)
  26. #pragma mark 需要强制重启
  27. - (void)updateForceStartFun{
  28. NSString* curSn = ksharedAppDelegate.DeviceThirdIdMod.data.changeSn;
  29. NSMutableDictionary *paraDict = [NSMutableDictionary dictionary];
  30. [paraDict setValue:curSn forKey:@"sn"];
  31. [paraDict setValue:[NSNumber numberWithBool:YES] forKey:@"isForceStart"];
  32. [[netWorkManager shareInstance] CommonPostCallBackCode:updateForceStart Parameters:paraDict success:^(id _Nonnull responseObject) {
  33. SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil];
  34. if (model.status == 0) {
  35. }
  36. else
  37. {
  38. }
  39. } failure:^(NSError * _Nonnull error) {
  40. HLog(@"%@", error);
  41. }];
  42. }
  43. #pragma mark 保存截图到相册
  44. - (void)screenShotToPhoneFun
  45. {
  46. [[webSocketManager shareInstance] screenshotInCloudPhoneFun];
  47. // CIImage *processedImage = saveCIImage;
  48. // CIContext *context = [CIContext contextWithOptions:nil];
  49. // CGImageRef cgiimage = [context createCGImage:processedImage fromRect:processedImage.extent];
  50. // UIImage *image = [UIImage imageWithCGImage:cgiimage];
  51. // CGImageRelease(cgiimage);
  52. //
  53. // if(!image){
  54. // self->needScreenShotType = YES;
  55. // return;
  56. // }
  57. //
  58. // [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
  59. // //写入图片到相册
  60. // PHAssetChangeRequest *req = [PHAssetChangeRequest creationRequestForAssetFromImage:image];
  61. //
  62. // } completionHandler:^(BOOL success, NSError * _Nullable error) {
  63. // //NSLog(@"success = %d, error = %@", success, error);
  64. // if (success) {
  65. // HLog(@"已将截图图片保存至相册");
  66. //
  67. // mainBlock(^{
  68. // [[iToast makeText:@""] show];
  69. // });
  70. //
  71. // } else {
  72. // self->needScreenShotType = YES;
  73. // HLog(@"未能将截图图片保存至相册");
  74. // }
  75. // }];
  76. }
  77. - (void)saveLastImageFun
  78. {
  79. if(!saveCIImage){
  80. return;
  81. }
  82. //UIImage *image = [UIImage imageWithCIImage:saveCIImage];
  83. CIImage *processedImage = saveCIImage;
  84. CIContext *context = [CIContext contextWithOptions:nil];
  85. CGImageRef cgiimage = [context createCGImage:processedImage fromRect:processedImage.extent];
  86. UIImage *image = [UIImage imageWithCGImage:cgiimage];
  87. CGImageRelease(cgiimage);
  88. if(image){ //执行返回最后一帧
  89. NSString *filePath = kSHPath_cloudPhone_last_image;
  90. NSString *folderPath = [kSHPath_cloudPhone_last_image stringByDeletingLastPathComponent];
  91. [[NSFileManager defaultManager] removeItemAtPath:folderPath error:nil];
  92. [cachesFileManager getCreateFilePath:folderPath];
  93. NSData*imageData = UIImagePNGRepresentation(image);
  94. BOOL ret = [imageData writeToFile:filePath atomically:NO];
  95. if (ret) {
  96. }
  97. }
  98. }
  99. - (void)readLastImageFun
  100. {
  101. NSString *filePath = kSHPath_cloudPhone_last_image;
  102. UIImage *image = [UIImage imageWithContentsOfFile:filePath];
  103. if(image && !saveCIImage){
  104. [mPlayerView.showImageView setImage:image];
  105. }
  106. }
  107. #pragma mark 重置云机编码
  108. - (void)reSetResolutionFactorFun
  109. {
  110. if([webSocketManager shareInstance].isDiDChangePhoneSizeType){
  111. CGFloat W = ksharedAppDelegate.couldPhone_W_PHONE;
  112. CGFloat H = ksharedAppDelegate.couldPhone_H_PHONE;
  113. CGFloat maxH = H > W ? H : W;
  114. NSString *dataStr = [RCCommandHelp commandResolutionFactorWithHeight:maxH];
  115. [self.liveStreamManager rc_sendJsonData:[dataStr UTF8String]];
  116. [webSocketManager shareInstance].isDiDChangePhoneSizeType = NO;
  117. }
  118. }
  119. @end