// // videoPlayByAVPlayerViewController.m // Private-X // // Created by xd h on 2024/5/22. // #import "videoPlayByAVPlayerViewController.h" #import "previewVideoPortraitTopMoreView.h" #import "editShareView.h" #import "uploadFileRecordViewController.h" #import "previewVideoLandscapeTopMoreView.h" #import "UIInterface+HXRotation.h" //#import //#import //#import //#import //#import "ZFUtilities.h" #import "ZFAVPlayerManager.h" #import "ZFIJKPlayerManager.h" #import "ZFPlayerControlView.h" #import "ZFPlayerConst.h" #import "ZFUtilities.h" #import "lastFileManager.h" #import "DFPlayer.h" @interface videoPlayByAVPlayerViewController () @property (nonatomic, strong) ZFPlayerController *player; @property (nonatomic, strong) ZFPlayerControlView *controlView; @property (nonatomic, strong)ZFAVPlayerManager *playerManager; @property (nonatomic, strong)UIView *bgView; @property (nonatomic, strong)UIButton *portraitBackBtn; @property (nonatomic, strong)UIButton *portraitToLandScapeBtn; @property (nonatomic, strong)UIButton *portraitTopMoreBtn; @property (nonatomic, strong)previewVideoPortraitTopMoreView *previewVideoPortraitTopMoreV; @property (nonatomic, strong)UIButton *landScapeToPortraitBtn; @property (nonatomic, strong)UIButton *landScapeTopMoreBtn; @property (nonatomic, strong)previewVideoLandscapeTopMoreView *previewVideoLandscapeTopMoreV; @property(nonatomic,strong) editShareView *editShareV; @property(nonatomic,assign) BOOL isPortraitType;//竖屏状态 @property(nonatomic,assign) BOOL isCodeSuspendAudioType;//手动暂停播放音乐 @property(nonatomic,assign) BOOL isCodeSuspendVideoType;//手动暂停播放视频 @property(nonatomic,assign) BOOL didHandleRotateingType;//是否正在处理旋转 @end @implementation videoPlayByAVPlayerViewController - (void)viewDidLoad { [super viewDidLoad]; [self.toolBar setHidden:YES]; [self.navigationBar setHidden:YES]; [self.navBarBGView setHidden:YES]; //self.navBarBGView.backgroundColor = [UIColor blackColor]; self.view.backgroundColor = [UIColor blackColor]; _isPortraitType = YES; //[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleDeviceOrientationChange) name:UIDeviceOrientationDidChangeNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didInputPwdOkFun) name:didInputPWDNotification object:nil]; _bgView = [[UIView alloc] init]; [self.view addSubview:_bgView]; [_bgView mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.bottom.mas_equalTo(-safeArea); make.top.mas_equalTo(H_STATE_BAR); }]; @zf_weakify(self) self.controlView.backBtnClickCallback = ^{ @zf_strongify(self) [self didClickBackBtnFun]; }; _playerManager = [[ZFAVPlayerManager alloc] init]; /// 播放器相关 self.player = [[ZFPlayerController alloc] initWithPlayerManager:_playerManager containerView:_bgView]; self.player.controlView = self.controlView; //self.player.allowOrentitaionRotation = NO; // self.player.orientationObserver.supportInterfaceOrientation = ZFInterfaceOrientationMaskLandscape; // [self.player rotateToOrientation:UIInterfaceOrientationLandscapeRight animated:NO completion:nil]; self.playerManager.playerPlayFailed = ^(id _Nonnull asset, id _Nonnull error) { mainBlock(^{ @zf_strongify(self) self.controlView.failBtn.hidden = YES; [[iToast makeText:NSLocalizedString(@"play_video_fail_tip",nil)] show]; }); }; self.playerManager.playerReadyToPlay = ^(id _Nonnull asset, NSURL * _Nonnull assetURL) { @zf_strongify(self) [self videoPlayerDidFun]; }; self.playerManager.playerDidToEnd = ^(id _Nonnull asset) { @zf_strongify(self) [self playerDidToEndFun]; }; //数据埋点 [[netWorkManager shareInstance] DataEmbeddingPointBy:4 withEventValue:@"Video_preview"]; if([DFPlayer sharedPlayer].state == DFPlayerStateBuffering ||[DFPlayer sharedPlayer].state == DFPlayerStatePlaying){ _isCodeSuspendAudioType = YES; [[DFPlayer sharedPlayer] df_pause]; } } - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; if(!self.playerManager.assetURL){ NSString *filePath = _VideoDataMode.path; NSString *urlStr = ksharedAppDelegate.NASFileByBoxService; NSString *fileUrl = [[NSString alloc] initWithFormat:@"%@getFile?path=%@",urlStr,filePath]; // NSString *string = filePath; // NSString *filePathBase64 = [iTools base64UrlEncoder:string]; // NSString *fileUrl = [[NSString alloc] initWithFormat:@"%@getFiles/%@",urlStr,filePathBase64]; NSString *showUrl = [[NSString alloc] initWithFormat:@"%@getThumbnail?path=%@",urlStr,filePath]; HLog(@"video url:%@",fileUrl); //fileUrl = @"http://transfertest.armclouding.com:10010/getFile?path=/sdcard/bb.mp4"; //fileUrl = @"http://testprivacy.phone.armclouding.com:1801/h5/123.mp4";//可以播放 //fileUrl = @"http://testprivacy.phone.armclouding.com:1801/h5/movTest.mov";//可以播放 //fileUrl = @"http://testprivacy.phone.armclouding.com:1801/h5/yinwei4.mp4";//可以播放 //fileUrl = @"http://testprivacy.phone.armclouding.com:1801/h5/fuchouzhe2.mp4";//可以播放 //fileUrl = @"http://testprivacy.phone.armclouding.com:1801/h5/fuchouzhe.m4v";//可以播放 //fileUrl = @"http://file.phone.androidscloud.com:8210/document/newFile/download/1/ikIm5C0KjKNvusTF6tIH/LowLevelMultipartUpload_45050149837826456388";//可以播放 //fileUrl = @"http://testprivacy.phone.armclouding.com:1801/h5/我的视频.mp4"; fileUrl = [fileUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; showUrl = [showUrl stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; //HLog(@"video url:%@",fileUrl); NSURL * sourceMovieURL= [NSURL URLWithString:fileUrl]; self.playerManager.assetURL = sourceMovieURL; [self.controlView showTitle:_VideoDataMode.name coverURLString:showUrl fullScreenMode:ZFFullScreenModeAutomatic]; [self customControlViewUIFun]; } //开始生成 设备旋转 通知 [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; //添加 设备旋转 通知 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientChangeFun) name:UIDeviceOrientationDidChangeNotification object:nil]; if(_isCodeSuspendVideoType){ [self.player.currentPlayerManager play]; } } - (void)viewWillDisappear:(BOOL)animated { [super viewWillDisappear:animated]; [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDarkContent]; //销毁 设备旋转 通知 [[NSNotificationCenter defaultCenter] removeObserver:self name:UIDeviceOrientationDidChangeNotification object:nil]; //结束 设备旋转通知 [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications]; if(_controlView.portraitControlView.playOrPauseBtn.selected ||_controlView.landScapeControlView.playOrPauseBtn.selected) { [self.player.currentPlayerManager pause]; _isCodeSuspendVideoType = YES; } //切换到竖屏 [self hx_rotateToInterfaceOrientation:UIInterfaceOrientationPortrait]; } - (BOOL)shouldAutorotate { return NO; } /**屏幕旋转的通知回调*/ - (void)orientChangeFun { UIDeviceOrientation orient = [UIDevice currentDevice].orientation; HLog(@"orientChangeFun :%d--%ld",_didHandleRotateingType,orient) if(_didHandleRotateingType){ return; } KWeakSelf switch (orient) { case UIDeviceOrientationPortrait: HLog(@"竖直屏幕"); if(!_isPortraitType){ _didHandleRotateingType = YES; [self.player rotateToOrientation:UIInterfaceOrientationPortrait animated:NO completion:^{ [weakSelf screenLandscapeToPortraitFun]; }]; } break; case UIDeviceOrientationLandscapeLeft: HLog(@"手机左转"); if(_isPortraitType){ _didHandleRotateingType = YES; [self.player rotateToOrientation:UIInterfaceOrientationLandscapeRight animated:NO completion:^{ [weakSelf screenPortraitToLandscapeFun]; }]; } break; case UIDeviceOrientationPortraitUpsideDown: // NSLog(@"手机竖直"); break; case UIDeviceOrientationLandscapeRight: HLog(@"手机右转"); if(_isPortraitType){ _didHandleRotateingType = YES; [self.player rotateToOrientation:UIInterfaceOrientationLandscapeLeft animated:NO completion:^{ [weakSelf screenPortraitToLandscapeFun]; }]; } break; case UIDeviceOrientationUnknown: //NSLog(@"未知"); break; case UIDeviceOrientationFaceUp: //NSLog(@"手机屏幕朝上"); break; case UIDeviceOrientationFaceDown: //NSLog(@"手机屏幕朝下"); break; default: break; } } - (void)handleDeviceOrientationChange { [self orientChangeFun]; } #pragma mark 竖屏转横屏 - (void)screenPortraitToLandscapeFun{ _isPortraitType = NO; _didHandleRotateingType = NO; if(_editShareV.secretShareView) { [_controlView.landScapeControlView addSubview:_editShareV.secretShareView]; [_editShareV.secretShareView mas_remakeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.bottom.mas_equalTo(0); make.top.mas_equalTo(0); }]; _editShareV.isPortraitType = _isPortraitType; _editShareV.secretShareView.isPortraitType = _isPortraitType; return; } if(_editShareV){ _editShareV.isPortraitType = _isPortraitType; [_controlView.landScapeControlView addSubview:_editShareV]; [self->_editShareV mas_remakeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.bottom.mas_equalTo(0); make.top.mas_equalTo(0); }]; } } #pragma mark 横屏转竖屏 - (void)screenLandscapeToPortraitFun{ _isPortraitType = YES; _didHandleRotateingType = NO; if(_editShareV.secretShareView) { [self.view addSubview:_editShareV.secretShareView]; [_editShareV.secretShareView mas_remakeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.bottom.mas_equalTo(0); make.top.mas_equalTo(0); }]; self->_editShareV.isPortraitType = self->_isPortraitType; self->_editShareV.secretShareView.isPortraitType = self->_isPortraitType; return; } if(_editShareV){ _editShareV.isPortraitType = _isPortraitType; [self.view addSubview:_editShareV]; [_editShareV mas_remakeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.bottom.mas_equalTo(0); make.top.mas_equalTo(0); }]; } } /// 如果不好用则copy VC中 加一下 - (UIInterfaceOrientationMask)supportedInterfaceOrientations { if (self.player.isFullScreen) { return UIInterfaceOrientationMaskLandscape; } return UIInterfaceOrientationMaskPortrait; } //- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation { // return UIInterfaceOrientationLandscapeRight; //} - (ZFPlayerControlView *)controlView { if (!_controlView) { _controlView = [ZFPlayerControlView new]; _controlView.fastViewAnimated = YES; _controlView.effectViewShow = NO; _controlView.prepareShowLoading = YES; //_controlView.showCustomStatusBar = YES; } return _controlView; } #pragma mark reset controlView UI - (void)customControlViewUIFun { //竖屏 _controlView.portraitControlView.fullScreenBtn.hidden = YES; //totalTimeLabel slider //隐藏 缓存条 // _controlView.bottomPgrogress.hidden = YES; // _controlView.fastProgressView.hidden = YES; UILabel *titleLab = _controlView.portraitControlView.titleLabel; titleLab.textAlignment = NSTextAlignmentCenter; titleLab.lineBreakMode = NSLineBreakByTruncatingMiddle; CGRect titleLabFrame = titleLab.frame; HLog(@"%f %f %f %f",titleLabFrame.origin.x,titleLabFrame.origin.y,titleLabFrame.size.width,titleLabFrame.size.height); HLog(@""); [titleLab mas_remakeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(45); make.right.mas_equalTo(-80); make.height.mas_equalTo(titleLabFrame.size.height); make.top.mas_equalTo(titleLabFrame.origin.y); }]; [_controlView.portraitControlView.topToolView addSubview:self.portraitBackBtn]; [self.portraitBackBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(15); make.width.mas_equalTo(28); make.height.mas_equalTo(28); make.top.mas_equalTo(titleLabFrame.origin.y); }]; [_controlView.portraitControlView.topToolView addSubview:self.portraitTopMoreBtn]; [self.portraitTopMoreBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-15); make.width.mas_equalTo(28); make.height.mas_equalTo(28); make.top.mas_equalTo(titleLabFrame.origin.y); }]; [_controlView.portraitControlView.topToolView addSubview:self.portraitToLandScapeBtn]; [self.portraitToLandScapeBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.equalTo(self.portraitTopMoreBtn.mas_left).offset(-10); make.width.mas_equalTo(28); make.height.mas_equalTo(28); make.top.mas_equalTo(titleLabFrame.origin.y); }]; /*************************************************************************/ //横屏 //_controlView.landScapeControlView.fullScreenBtn.hidden = YES; //[_controlView.landScapeControlView.backBtn addTarget:self action:@selector(didClickBackBtnFun) forControlEvents:UIControlEventTouchUpInside]; UILabel *titleLabInlandScape = _controlView.landScapeControlView.titleLabel; titleLabInlandScape.textAlignment = NSTextAlignmentCenter; titleLabInlandScape.lineBreakMode = NSLineBreakByTruncatingMiddle; //CGRect titleLabFrameInlandScape = titleLabInlandScape.frame; //titleLabInlandScape.backgroundColor = [UIColor greenColor]; [titleLabInlandScape mas_remakeConstraints:^(MASConstraintMaker *make) { make.left.equalTo(_controlView.landScapeControlView.backBtn.mas_right).offset(10); //make.right.mas_equalTo(-45); make.right.mas_equalTo(-25 -90); //make.height.mas_equalTo(titleLabFrameInlandScape.size.height); make.top.equalTo(_controlView.landScapeControlView.backBtn.mas_top).offset(0); make.bottom.equalTo(_controlView.landScapeControlView.backBtn.mas_bottom).offset(0); }]; [_controlView.landScapeControlView.topToolView addSubview:self.landScapeTopMoreBtn]; [self.landScapeTopMoreBtn mas_makeConstraints:^(MASConstraintMaker *make) { make.right.mas_equalTo(-15 - 20); make.width.mas_equalTo(28); make.height.mas_equalTo(28); //make.top.mas_equalTo(titleLabFrame.origin.y); make.centerY.equalTo(_controlView.landScapeControlView.backBtn.mas_centerY).offset(0); }]; [_controlView.landScapeControlView.topToolView addSubview:self.landScapeToPortraitBtn]; [self.landScapeToPortraitBtn mas_makeConstraints:^(MASConstraintMaker *make) { //make.right.mas_equalTo(-15); make.right.equalTo(self.landScapeTopMoreBtn.mas_left).offset(-20); make.width.mas_equalTo(28); make.height.mas_equalTo(28); //make.top.mas_equalTo(titleLabFrame.origin.y); make.centerY.equalTo(_controlView.landScapeControlView.backBtn.mas_centerY).offset(0); }]; } - (UIButton *)portraitBackBtn { if (!_portraitBackBtn) { _portraitBackBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [_portraitBackBtn setImage:ZFPlayer_Image(@"ZFPlayer_back_full") forState:UIControlStateNormal]; [_portraitBackBtn addTarget:self action:@selector(didClickBackBtnFun) forControlEvents:UIControlEventTouchUpInside]; } return _portraitBackBtn; } - (UIButton *)portraitToLandScapeBtn { if (!_portraitToLandScapeBtn) { _portraitToLandScapeBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [_portraitToLandScapeBtn setImage:[UIImage imageNamed:@"portraitFullScreen_icon"] forState:UIControlStateNormal]; [_portraitToLandScapeBtn addTarget:self action:@selector(portraitOrLandScapeFun:) forControlEvents:UIControlEventTouchUpInside]; //_portraitToLandScapeBtn.backgroundColor = [UIColor greenColor]; } return _portraitToLandScapeBtn; } - (UIButton*)portraitTopMoreBtn{ if (!_portraitTopMoreBtn) { _portraitTopMoreBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [_portraitTopMoreBtn setImage:[UIImage imageNamed:@"nas_preview_more_white"] forState:UIControlStateNormal]; [_portraitTopMoreBtn addTarget:self action:@selector(didClickMoreButFun:) forControlEvents:UIControlEventTouchUpInside]; //_portraitTopMoreBtn.backgroundColor = [UIColor greenColor]; } return _portraitTopMoreBtn; } - (UIButton *)landScapeToPortraitBtn { if (!_landScapeToPortraitBtn) { _landScapeToPortraitBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [_landScapeToPortraitBtn setImage:[UIImage imageNamed:@"landScapeToPortrait_icon"] forState:UIControlStateNormal]; [_landScapeToPortraitBtn addTarget:self action:@selector(portraitOrLandScapeFun:) forControlEvents:UIControlEventTouchUpInside]; //_portraitToLandScapeBtn.backgroundColor = [UIColor greenColor]; } return _landScapeToPortraitBtn; } - (UIButton*)landScapeTopMoreBtn{ if (!_landScapeTopMoreBtn) { _landScapeTopMoreBtn = [UIButton buttonWithType:UIButtonTypeCustom]; [_landScapeTopMoreBtn setImage:[UIImage imageNamed:@"nas_preview_more_white"] forState:UIControlStateNormal]; [_landScapeTopMoreBtn addTarget:self action:@selector(didClickMoreButFun:) forControlEvents:UIControlEventTouchUpInside]; //_portraitTopMoreBtn.backgroundColor = [UIColor greenColor]; } return _landScapeTopMoreBtn; } #pragma mark 点击返回键 - (void)didClickBackBtnFun { [self.player stop]; //_didClickBackType = YES; if(_isCodeSuspendAudioType){ [[DFPlayer sharedPlayer] df_play]; } [self.navigationController popViewControllerAnimated:YES]; } #pragma mark 横竖屏切换 - (void)portraitOrLandScapeFun:(UIButton*)but { if(but ==_portraitToLandScapeBtn){ //[self.player enterFullScreen:YES animated:YES];; [self.player rotateToOrientation:UIInterfaceOrientationLandscapeRight animated:YES completion:nil]; } else{ [self.player rotateToOrientation:UIInterfaceOrientationPortrait animated:YES completion:nil]; } } #pragma mark 点击顶部更多 获取 分享 下载 更多 - (void)didClickMoreButFun:(UIButton*)but { if(but ==_portraitTopMoreBtn){ _previewVideoPortraitTopMoreV = [[previewVideoPortraitTopMoreView alloc] init]; [self.view addSubview:_previewVideoPortraitTopMoreV]; [_previewVideoPortraitTopMoreV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.bottom.mas_equalTo(0); make.top.mas_equalTo(0); }]; KWeakSelf _previewVideoPortraitTopMoreV.didClickButtonFun = ^(NSInteger tag) { if(tag == 10){ [weakSelf gotoShareViewFun:NO]; } else if (tag == 11){ [weakSelf gotoDownLoadFileFun:NO]; } else if (tag == 12){ [weakSelf showDeleteAlearViewFun]; } }; } else{ _previewVideoLandscapeTopMoreV = [[previewVideoLandscapeTopMoreView alloc] init]; [_controlView.landScapeControlView addSubview:_previewVideoLandscapeTopMoreV]; [_previewVideoLandscapeTopMoreV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.bottom.mas_equalTo(0); make.top.mas_equalTo(0); }]; KWeakSelf _previewVideoLandscapeTopMoreV.didClickButtonFun = ^(NSInteger tag) { if(tag == 10){ [weakSelf gotoShareViewFun:YES]; } else if (tag == 11){ [weakSelf gotoDownLoadFileFun:YES]; } else if (tag == 12){ [weakSelf didClickDeleteInLandscapeFun]; } }; } } #pragma mark 横屏点击删除 - (void)didClickDeleteInLandscapeFun { //横屏的删除 要转竖屏 // [self.player rotateToOrientation:UIInterfaceOrientationPortrait animated:NO completion:^{ // [self screenLandscapeToPortraitFun]; // [self showDeleteAlearViewFun]; // }]; //修复iOS15 bug [self.player rotateToOrientation:UIInterfaceOrientationPortrait animated:NO completion:^{ }]; KWeakSelf dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [weakSelf screenLandscapeToPortraitFun]; [weakSelf showDeleteAlearViewFun]; }); } #pragma mark 视频可以播放 加入最近文件 - (void)videoPlayerDidFun{ NASFileAndFolderDataModel *dataModel = _VideoDataMode; lastFileModel *lastFileMod = [lastFileModel new]; lastFileMod.path = dataModel.path; lastFileMod.name = dataModel.name; lastFileMod.time = dataModel.time; lastFileMod.size = dataModel.size; lastFileMod.duration = dataModel.duration; lastFileMod.type = @"video"; lastFileMod.lastPreTime = [iTools getNowTimeStamp]; [[lastFileManager shareManager] saveFileInfoWith:lastFileMod with:dataModel.path]; } #pragma mark 用户点击分享 - (void)gotoShareViewFun:(BOOL)isLandscapeType { if(!_VideoDataMode){ return; } if(isLandscapeType){//强制竖屏 //修复iOS15 bug [self.player rotateToOrientation:UIInterfaceOrientationPortrait animated:NO completion:^{ }]; isLandscapeType = NO; } _editShareV = [[editShareView alloc] init]; _editShareV.didSelectListArr = [NSMutableArray arrayWithArray:@[_VideoDataMode]]; _editShareV.shareFileType = @"3"; if(isLandscapeType){ _editShareV.isPortraitType = NO; [_controlView.landScapeControlView addSubview:_editShareV]; } else{ _editShareV.isPortraitType = YES; [self.view addSubview:_editShareV]; } [_editShareV mas_makeConstraints:^(MASConstraintMaker *make) { make.left.mas_equalTo(0); make.right.mas_equalTo(0); make.bottom.mas_equalTo(0); make.top.mas_equalTo(0); }]; KWeakSelf _editShareV.didClickCloseFun = ^{ [weakSelf clearShareAboutViewFun]; }; } #pragma mark 清理分享相关页面 - (void)clearShareAboutViewFun { if(_editShareV.secretShareView){ _editShareV.secretShareView = nil; } _editShareV = nil; } #pragma mark 删除视频 - (void)showDeleteAlearViewFun { NSString *titleStr = NSLocalizedString(@"delete_file_title_msg",nil); NSString *tipStr = NSLocalizedString(@"delete_file_tip_msg",nil); KWeakSelf ComontAlretViewController *curAlretVC= [[ComontAlretViewController alloc] initWithTiTle:titleStr msg:tipStr imageStr:nil cancelTitle:NSLocalizedString(@"other_cancel",nil) okTitle:NSLocalizedString(@"other_confirm",nil) isOkBtnHighlight:YES didClickOk:^{ [weakSelf delFileListFun]; } didClickCancel:^{ }]; curAlretVC.modalPresentationStyle = UIModalPresentationCustom; [self presentViewController:curAlretVC animated:YES completion:^{ curAlretVC.view.superview.backgroundColor = [UIColor clearColor]; }]; } #pragma mark 删除文件数据 - (void)delFileListFun { NSMutableDictionary*paraDict = [NSMutableDictionary new]; if(_VideoDataMode){ NSArray *pathArr = @[_VideoDataMode.path]; [paraDict setValue:pathArr forKey:@"path"]; } [self showNewIndicatorWithCanBack:YES canTouch:NO]; //NSString*code = [[NSString alloc] initWithFormat:@"delFile?path=%@",paraDict[@"path"]]; //delFile?path=[/storage/emulated/0/Download/IMG_6464.HEIC] KWeakSelf //@"delFile" [[netWorkManager shareInstance] cloudPhonePostCallBackCode:@"delFile" Parameters:paraDict success:^(id _Nonnull responseObject) { [weakSelf removeNewIndicator]; SuperModel *model = [[SuperModel alloc] initWithDictionary:responseObject error:nil]; if(model && model.status == 0){ [[iToast makeText:NSLocalizedString(@"delete_file_suc_msg",nil)] show]; [weakSelf didDeleteSucFun:self->_VideoDataMode.path]; } else{ } } failure:^(NSError * _Nonnull error) { [weakSelf removeNewIndicator]; }]; //数据埋点 [[netWorkManager shareInstance] DataEmbeddingPointBy:3 withEventValue:@"Video_delete"]; } #pragma mark 删除成功 - (void)didDeleteSucFun:(NSString*)path { //1.删除最近文件数据 [[lastFileManager shareManager] deleteFileInfoWithUrl:path]; if(_didNeedDeleteFile){ _didNeedDeleteFile(path); } [self.navigationController popViewControllerAnimated:YES]; } #pragma mark 去下载文件 - (void)gotoDownLoadFileFun:(BOOL)isLandscapeType { if(_VideoDataMode){ if(isLandscapeType){ //切换到竖屏 //[self hx_rotateToInterfaceOrientation:UIInterfaceOrientationPortrait]; [self.player rotateToOrientation:UIInterfaceOrientationPortrait animated:YES completion:nil]; } couldPhoneFileModel* fileModel = [couldPhoneFileModel new]; fileModel.fileType = _VideoDataMode.type; fileModel.path = _VideoDataMode.path; fileModel.name = _VideoDataMode.name; fileModel.length = _VideoDataMode.size; NSMutableArray *arr = [NSMutableArray new]; [arr addObject:fileModel]; //切换到竖屏 [self hx_rotateToInterfaceOrientation:UIInterfaceOrientationPortrait]; uploadFileRecordViewController *vc = [uploadFileRecordViewController new]; [self.navigationController pushViewController:vc animated:YES]; vc.isDownloadingType = YES; [vc gotoDownloadFile:arr]; } } #pragma mark 输入完密码 - (void)didInputPwdOkFun { if(ksharedAppDelegate.DeviceThirdIdMod.data.isPrivacyMode){ if(self.player.pauseByEvent){//隐私模式 是 self.player.pauseByEvent = NO; } } } #pragma mark 播放完成 - (void)playerDidToEndFun { KWeakSelf [self.player seekToTime:0 completionHandler:^(BOOL finished) { [weakSelf.playerManager pause]; [weakSelf.controlView.portraitControlView playBtnSelectedState:NO]; [weakSelf.controlView.landScapeControlView playBtnSelectedState:NO]; }]; } @end