// // PlayerViewController+otherDelegate.m // 隐私保护 // // Created by xd h on 2023/10/13. // #import "PlayerViewController+otherDelegate.h" #import "RCCommandHelp.h" #import "couldPhoneBaseInfoModel.h" #import "cachesFileManager.h" #import "couldphoneSysInfoModel.h" #import "TvStatusModel.h" #import "HWVersionModel.h" #import #import "HaveNewVersionView.h" #import "connectDeviceManager.h" #import "downloadManager.h" #import "uploadFileManager.h" #import "cloudPhoneExtraFileListModel.h" #import "AppDelegate.h" #import "cachesFileManager.h" #import "extraMediaEventModel.h" #import "USBInsertPopView.h" #import "commandSendCheckModel.h" @implementation PlayerViewController (otherDelegate) #pragma mark 需要强制重启 - (void)updateForceStartFun{ NSString* curSn = ksharedAppDelegate.DeviceThirdIdMod.data.changeSn; NSMutableDictionary *paraDict = [NSMutableDictionary dictionary]; [paraDict setValue:curSn forKey:@"sn"]; [paraDict setValue:[NSNumber numberWithBool:YES] forKey:@"isForceStart"]; [[netWorkManager shareInstance] CommonPostCallBackCode:updateForceStart Parameters:paraDict success:^(id _Nonnull responseObject) { SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil]; if (model.status == 0) { } else { } } failure:^(NSError * _Nonnull error) { HLog(@"%@", error); }]; } #pragma mark 保存截图到相册 - (void)screenShotToPhoneFun { [[webSocketManager shareInstance] screenshotInCloudPhoneFun]; // CIImage *processedImage = saveCIImage; // CIContext *context = [CIContext contextWithOptions:nil]; // CGImageRef cgiimage = [context createCGImage:processedImage fromRect:processedImage.extent]; // UIImage *image = [UIImage imageWithCGImage:cgiimage]; // CGImageRelease(cgiimage); // // if(!image){ // self->needScreenShotType = YES; // return; // } // // [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ // //写入图片到相册 // PHAssetChangeRequest *req = [PHAssetChangeRequest creationRequestForAssetFromImage:image]; // // } completionHandler:^(BOOL success, NSError * _Nullable error) { // //NSLog(@"success = %d, error = %@", success, error); // if (success) { // HLog(@"已将截图图片保存至相册"); // // mainBlock(^{ // [[iToast makeText:@""] show]; // }); // // } else { // self->needScreenShotType = YES; // HLog(@"未能将截图图片保存至相册"); // } // }]; } - (void)saveLastImageFun { if(!saveCIImage){ return; } //UIImage *image = [UIImage imageWithCIImage:saveCIImage]; CIImage *processedImage = saveCIImage; CIContext *context = [CIContext contextWithOptions:nil]; CGImageRef cgiimage = [context createCGImage:processedImage fromRect:processedImage.extent]; UIImage *image = [UIImage imageWithCGImage:cgiimage]; CGImageRelease(cgiimage); if(image){ //执行返回最后一帧 NSString *filePath = kSHPath_cloudPhone_last_image; NSString *folderPath = [kSHPath_cloudPhone_last_image stringByDeletingLastPathComponent]; [[NSFileManager defaultManager] removeItemAtPath:folderPath error:nil]; [cachesFileManager getCreateFilePath:folderPath]; NSData*imageData = UIImagePNGRepresentation(image); BOOL ret = [imageData writeToFile:filePath atomically:NO]; if (ret) { } } } - (void)readLastImageFun { NSString *filePath = kSHPath_cloudPhone_last_image; UIImage *image = [UIImage imageWithContentsOfFile:filePath]; if(image && !saveCIImage){ [mPlayerView.showImageView setImage:image]; } } #pragma mark 重置云机编码 - (void)reSetResolutionFactorFun { if([webSocketManager shareInstance].isDiDChangePhoneSizeType){ CGFloat W = ksharedAppDelegate.couldPhone_W_PHONE; CGFloat H = ksharedAppDelegate.couldPhone_H_PHONE; CGFloat maxH = H > W ? H : W; NSString *dataStr = [RCCommandHelp commandResolutionFactorWithHeight:maxH]; [self.liveStreamManager rc_sendJsonData:[dataStr UTF8String]]; [webSocketManager shareInstance].isDiDChangePhoneSizeType = NO; } } @end