@property(nonatomic)NSString *urlStr;深拷贝和浅拷贝

tech2023-05-08  114

字符串在通知中莫名其妙被改了值,居然把修饰符从copy变成strong就行了

 

 (void)viewWillAppear:(BOOL)animated {     [super viewWillAppear:animated];     [self.navigationController setNavigationBarHidden:YES animated:YES];     self.player.viewControllerDisappear = NO;     [self acquireReloadNetWorking];           } - (void)viewDidAppear:(BOOL)animated {     [super viewDidAppear:animated];     [self.navigationController setNavigationBarHidden:YES animated:YES]; } - (void)viewWillDisappear:(BOOL)animated {     [super viewWillDisappear:animated];     [self.navigationController setNavigationBarHidden:false animated:YES];     if ([self.isPresent isEqualToString:@"1"]) {              }     else     {         self.player.viewControllerDisappear = YES;         [self pauseTimer];         [self removeTimerFromSelf];         self.player.pauseWhenAppResignActive = YES;         self.player.pauseByEvent = YES;         [self.player.currentPlayerManager pause];         [self.player stop];         [self.moviePlayerView removeFromSuperview];         self.moviePlayerView = nil;         self.player = nil;     }      } - (void)viewDidDisappear:(BOOL)animated {     [super viewDidDisappear:animated];     [self.navigationController setNavigationBarHidden:false animated:YES];     if ([self.isPresent isEqualToString:@"1"]) {              }     else     {         self.player.viewControllerDisappear = YES;         [self pauseTimer];         [self removeTimerFromSelf];         self.player.pauseWhenAppResignActive = YES;         self.player.pauseByEvent = YES;         [self.player.currentPlayerManager pause];         [self.player stop];         [self.moviePlayerView removeFromSuperview];         self.moviePlayerView = nil;         [self.player.currentPlayerManager stop];         self.player = nil;     } } - (void)configureAudioUI {           self.listeningV416View = [[UIView alloc]initWithFrame:CGRectMake(0, 0, kUIScreenWidth, kUIFitSize(192))];     self.listeningV416View.backgroundColor = [UIColor whiteColor];     [self.view addSubview:self.listeningV416View];     UIImageView *bgImg = [[UIImageView alloc] initWithFrame:CGRectMake(0, kStatusBarH, kUIScreenWidth, kUIFitSize(192)-kStatusBarH)];     self.listeningV416bgImageV = bgImg;     bgImg.userInteractionEnabled = YES;     bgImg.image = [UIImage imageNamed:@"bj_img"];     [self.listeningV416View addSubview:bgImg];     self.audioTitleLabel = [[UILabel alloc] init];     [bgImg addSubview:self.audioTitleLabel];     self.audioTitleLabel.numberOfLines = 3;     self.audioTitleLabel.font = [UIFont systemFontOfSize:13];     self.audioTitleLabel.textColor = [UIColor whiteColor]; //    self.audioTitleLabel.backgroundColor = [UIColor blueColor];     [self.audioTitleLabel mas_makeConstraints:^(MASConstraintMaker *make) {         make.left.equalTo(@40);         make.top.equalTo (@(kStatusBarH));         make.width.equalTo(@100); //        make.height.equalTo(@100);     }];          UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];     backBtn.frame = CGRectMake(0, 0, kUIFitSize(44), kUIFitSize(50));     [backBtn setImage:[UIImage imageNamed:@"back_arrow"] forState:UIControlStateNormal];     [backBtn addTarget:self action:@selector(backActionAction) forControlEvents:UIControlEventTouchUpInside];     [bgImg addSubview:backBtn];

         NSArray *imgArr = @[@"ic_ds",@"shouye_ic_xiazai",@"ic_ej_sele"];     CGFloat btnWH = kUIFitSize(55);     CGFloat margin = kUIFitSize(14);     for (int i = 0; i < 3; i ++) {         UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];         btn.frame = CGRectMake(kUIScreenWidth- btnWH*4 + (btnWH + margin) * i, 0 , btnWH, btnWH);         [btn setImage:[UIImage imageNamed:imgArr[i]] forState:UIControlStateNormal];         btn.tag = 233+i;         [btn addTarget:self action:@selector(tipsBtnClick:) forControlEvents:UIControlEventTouchUpInside];         [bgImg addSubview:btn];         if (i == 0) {             self.daojishiBtn = btn;         }     }      //       SZPortraitControlView *portraitView = self.controlView.portraitControlView;

        

                 CGFloat smallBtnW = kUIFitSize(36);         CGFloat smallBtnH = kUIFitSize(36);         CGFloat smallBtnTop = 68;         CGFloat bigBtnWH = kUIFitSize(70);         CGFloat bigBtnTop = 48;                  //快退         UIButton *retreatBtn = [UIButton buttonWithType:UIButtonTypeCustom];         retreatBtn.frame = CGRectMake(kUIFitSize(27), smallBtnTop, smallBtnW, smallBtnH);         [retreatBtn setImage:[UIImage imageNamed:@"ic_kj"] forState:UIControlStateNormal];         [retreatBtn addTarget:self action:@selector(retreatBtnClick) forControlEvents:UIControlEventTouchUpInside];         [bgImg addSubview:retreatBtn];                  //上一曲         UIButton *lastBtn = [UIButton buttonWithType:UIButtonTypeCustom];         lastBtn.frame = CGRectMake(kUIFitSize(90), smallBtnTop, smallBtnW, smallBtnH);         [lastBtn setImage:[UIImage imageNamed:@"ic_xq"] forState:UIControlStateNormal];         [lastBtn addTarget:self action:@selector(yinpinPrexNoti) forControlEvents:UIControlEventTouchUpInside];         [bgImg addSubview:lastBtn];                  //开始、暂停audio_begin         UIButton *startBtn = [UIButton buttonWithType:UIButtonTypeCustom];         startBtn.frame = CGRectMake(kUIFitSize(153), bigBtnTop, bigBtnWH, bigBtnWH);         [startBtn setImage:[UIImage imageNamed:@"ic_yp_bf"] forState:UIControlStateNormal];         [startBtn setImage:[UIImage imageNamed:@"ic_bf_yp"] forState:UIControlStateSelected];         [startBtn addTarget:self action:@selector(startBtnClick:) forControlEvents:UIControlEventTouchUpInside];         [bgImg addSubview:startBtn];         self.startAudioBtn = startBtn;         //下一曲         UIButton *nextBtn = [UIButton buttonWithType:UIButtonTypeCustom];         nextBtn.frame = CGRectMake(kUIFitSize(250), smallBtnTop, smallBtnW, smallBtnH);         [nextBtn setImage:[UIImage imageNamed:@"ic_xh"] forState:UIControlStateNormal];         [nextBtn addTarget:self action:@selector(yinpinnextNoti) forControlEvents:UIControlEventTouchUpInside];         [bgImg addSubview:nextBtn];                  //快进         UIButton *forwardBtn = [UIButton buttonWithType:UIButtonTypeCustom];         forwardBtn.frame = CGRectMake(kUIFitSize(318), smallBtnTop, smallBtnW, smallBtnH);         [forwardBtn setImage:[UIImage imageNamed:@"ic_kt"] forState:UIControlStateNormal];         [forwardBtn addTarget:self action:@selector(forwardBtnClick) forControlEvents:UIControlEventTouchUpInside];         [bgImg addSubview:forwardBtn];     

    //播放进度         SZPortraitControlView *portraitView = self.controlView.portraitControlView;         SZSliderView *audioslider = self.controlView.portraitControlView.slider;     //    ZFSliderView *audioslider = [[ZFSliderView alloc]init];         audioslider.frame = CGRectMake(25, kUIFitSize(192) - 24, kUIScreenWidth-50, 24);         audioslider.value = 0;         audioslider.sliderBtn.backgroundColor = [UIColor clearColor];         audioslider.sliderBtn.layer.cornerRadius = audioslider.sliderBtn.width / 2;         audioslider.maximumTrackTintColor = RGBColor(218, 218, 218);         audioslider.minimumTrackTintColor = RGBColor(10, 147, 255);     //    [playView addSubview:audioslider];

        //当前播放时间         UILabel *currentProgressLabel = [[UILabel alloc] initWithFrame:CGRectMake(kUIFitSize(15), bgImg.height - kUIFitSize(21), 100, kUIFitSize(16))];         currentProgressLabel.textColor = [UIColor whiteColor];         currentProgressLabel.font = [UIFont systemFontOfSize:kUIFitSize(12)];         currentProgressLabel.text = portraitView.currentTimeLabel.text;     //    [bgImg addSubview:currentProgressLabel];     //    portraitView.currentTimeLabel = currentProgressLabel;

        //音频总时间         UILabel *maxProgressLabel = [[UILabel alloc] initWithFrame:CGRectMake(kUIScreenWidth - kUIFitSize(115), bgImg.height - kUIFitSize(21), kUIFitSize(100), kUIFitSize(16))];         maxProgressLabel.textColor = [UIColor whiteColor];         maxProgressLabel.font = [UIFont systemFontOfSize:kUIFitSize(12)];         maxProgressLabel.text = portraitView.totalTimeLabel.text;//@"32:17";         maxProgressLabel.textAlignment = NSTextAlignmentRight;         self.listeningV416View.hidden = YES;       WS(weakself)        self.player.playerPlayTimeChanged = ^(id<SZPlayerMediaPlayback>  _Nonnull asset, NSTimeInterval currentTime, NSTimeInterval duration) {

            if ([weakself.isPlay isEqualToString:@"0"]&&(weakself.controlView.portraitControlView.slider.isdragging)) {                  weakself.isPlay = @"1";                 [weakself.startAudioBtn setImage:[UIImage imageNamed:@"ic_yp_bf"] forState:UIControlStateNormal];             }             if ((weakself.controlView.portraitControlView.slider.isdragging) && weakself.stopPlayout) {                 NSTimeInterval currentTimeSec = weakself.player.currentTime;                 //获取已经播放的时间                 NSTimeInterval totalTimeSec = weakself.player.totalTime;                                  weakself.timeout  = floor(totalTimeSec - currentTimeSec+0.5);                 [weakself startResidualTimer];             }           NSString *currentStr = [NSString stringWithFormat:@"%f",currentTime];            NSLog(@"currentLearnModel.lecture_length%@",weakself.currentLearnModel.lecture_length);                   NSLog(@"currentTime%f",currentTime);            NSArray *totolTimeArray=[weakself.controlView.portraitControlView.totalTimeLabel.text componentsSeparatedByString:@":"];            switch (totolTimeArray.count) {                case 2:                {                    NSString *minuteStr = [totolTimeArray firstObject];                    NSString *secondStr = totolTimeArray[1];                    weakself.maxTotolSecondNsnumber =minuteStr.intValue *60+secondStr.intValue;                }                    break;                case 3:                {                    NSString *hourStr = totolTimeArray[0];                    NSString *minuteStr = totolTimeArray[1];                    NSString *secondStr = totolTimeArray[2];                    weakself.maxTotolSecondNsnumber =hourStr.intValue *3600+ minuteStr.intValue *60+secondStr.intValue;                }                    break;                default:                {                    NSString *secondStr = totolTimeArray[0];                    weakself.maxTotolSecondNsnumber = secondStr.intValue;                }                    break;            }            NSString *currentRate = [NSString stringWithFormat:@"%f",currentTime/weakself.maxTotolSecondNsnumber*100];            NSNumberFormatter *tempNum = [[NSNumberFormatter alloc] init];

           [tempNum setNumberStyle:NSNumberFormatterDecimalStyle];

           NSNumber *numTemp = [tempNum numberFromString:currentRate];

           int currentInt = currentTime;            NSNumber *percent =nil;            if (weakself.maxTotolSecondNsnumber*weakself.currentLearnModel.progress.intValue>currentInt*100) {                percent = weakself.currentLearnModel.progress;            } else {                percent = numTemp;            }            NSDictionary *dic = @{@"limit_speed":weakself.detailModel.study_configModel.limit_speed.intValue?weakself.detailModel.study_configModel.limit_speed:@0,                                  @"percent":percent.intValue?percent:@0,                                  @"isFullScreen":[NSNumber numberWithBool:weakself.player.isFullScreen]            };            [[NSNotificationCenter defaultCenter] postNotificationName:KClassIsPerpisssionSliderDrag object:dic];         }; } - (void)addMovueNoti {     //    _moviePlayerView = [[UIView alloc]init];     //    [self.view addSubview:_moviePlayerView];     //    _moviePlayerView.frame = CGRectMake(0, 0, kUIScreenWidth, kUIFitSize(192));     //    _moviePlayerView.backgroundColor = [UIColor colorWithRed:170 / 255.0 green:170 / 255.0 blue:170 / 255.0 alpha:1.0];      } - (void)addPopState {     self.isPresent = @"0"; } - (void)keepPlayer {     self.isPresent = @"1";//保持播放状态 } - (void)viewDidLoad {     [super viewDidLoad];     if ([self.urlStr containsString:@"company-course"]) {//自制课程         self.titleAry = @[@"简介",@"目录"];         self.keysAry = @[@"1",@"2"];     } else {//先之课程         self.titleAry = @[@"简介",@"目录",@"讲义"];         self.keysAry = @[@"1",@"2",@"3"];     }     self.listTableView.delegate = self;     self.listTableView.dataSource = self;     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(changePlayState:) name:KChangeTapClassNotifition object:nil];     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(yinpinnextNoti) name:KYInpinNextPaly object:nil];     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(yinpinPrexNoti) name:KYInpinPreviousPaly object:nil];     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(kaishixuexiNoti) name:Kaishixuexiliucheng object:nil];     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addMovueNoti) name:KmovieView object:nil];     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(addPopState) name:@"XMNotification" object:nil];     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keepPlayer) name:KkeepPlayer object:nil];     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(backActionAction) name:@"learnbackAction" object:nil];     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(jumpToEvalueate) name:KJumpToEvaluate object:nil];     // app启动或者app从后台进入前台都会调用这个方法     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationBecomeActive) name:UIApplicationDidBecomeActiveNotification object:nil];     // app从后台进入前台都会调用这个方法     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationBecomeActive) name:UIApplicationWillEnterForegroundNotification object:nil];     // 添加检测app进入后台的观察者     [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationEnterBackground) name: UIApplicationDidEnterBackgroundNotification object:nil];          [self handleService];     WS(weakSelf);     self.view.backgroundColor = kGlobalBg;     SZAVPlayerManager *playerManager = [[SZAVPlayerManager alloc] init];     //    KSMediaPlayerManager *playerManager = [[KSMediaPlayerManager alloc] init];     //    ZFIJKPlayerManager *playerManager = [[ZFIJKPlayerManager alloc] init];     [playerManager setScalingMode:SZPlayerScalingModeAspectFill];     self.playerManager = playerManager;          /// 播放器相关     self.player = [SZPlayerController playerWithPlayerManager:playerManager containerView:_moviePlayerView];     self.player.controlView = self.controlView;     self.player.currentPlayerManager.scalingMode = SZPlayerScalingModeAspectFit;           //横竖屏切换回调方法         self.player.orientationWillChange = ^(SZPlayerController * _Nonnull player, BOOL isFullScreen) {             [weakSelf setNeedsStatusBarAppearanceUpdate];             if (isFullScreen){//切换到全屏

            }else{//切换到竖屏                     }         };         self.player.orientationDidChanged = ^(SZPlayerController * _Nonnull player, BOOL isFullScreen) {                          [weakSelf setNeedsStatusBarAppearanceUpdate];             if (isFullScreen){//切换到全屏                            }else{//切换到竖屏               //                 if ([weakSelf.player.assetURL.absoluteString containsString:@"mp3"] ) {                     weakSelf.controlView.portraitControlView.currentTimeLabel.frame = CGRectMake(0, kUIFitSize(192)-40, 100, 24);                     weakSelf.controlView.portraitControlView.totalTimeLabel.frame = CGRectMake(kUIScreenWidth-100, kUIFitSize(192)-40, 70, 24);                     weakSelf.controlView.portraitControlView.slider.frame = CGRectMake(90,  kUIFitSize(192)-40, kUIScreenWidth-180, 24);;                     weakSelf.audioTitleLabel.text = weakSelf.currentLearnModel.lecture_title;                 }             }         };

    /// 播放完自动播放下一个     self.player.playerDidToEnd = ^(id  _Nonnull asset) {                  //       @strongify(self)todoafter 搞不懂用法暂时注释         [weakSelf.player.orientationObserver exitFullScreenWithAnimated:YES];         [weakSelf.player.currentPlayerManager pause];         [weakSelf acqucireRecordServiceProgress:100 curpage:0];//自动切换防止视频内容过短导致请求不到约定间隔请求达不到100%         [weakSelf acquireSecondToSaveTotolTimeIsPop:NO];//请求时长         [weakSelf playNext];         //播放当前进度         //        NSTimeInterval currentTime = weakSelf.player.totalTime;         //         NSInteger current = round(currentTime);         //        [weakSelf acqucireRecordServiceProgress:@(100) curpage:current];         //        [weakSelf playNextLecture]; 播放下一章节              };     self.player.playerPlayStateChanged = ^(id<SZPlayerMediaPlayback>  _Nonnull asset, SZPlayerPlaybackState playState) {         if (playState ==SZPlayerPlayStatePaused) {             [weakSelf.startAudioBtn setImage:[UIImage imageNamed:@"ic_bf_yp"] forState:UIControlStateNormal];             [weakSelf pauseTimer];         }         else         {             [weakSelf.startAudioBtn setImage:[UIImage imageNamed:@"ic_yp_bf"] forState:UIControlStateNormal];             [weakSelf beginTimer];         }              };          //禁止侧滑     id traget = self.navigationController.interactivePopGestureRecognizer.delegate;     UIPanGestureRecognizer * pan = [[UIPanGestureRecognizer alloc]initWithTarget:traget action:nil];     [self.view addGestureRecognizer:pan];               self.isLoadingLectures = YES;     //todo  这块等规则出来了再去定义如何操作 比如默认播放什么或者上次记录哪个页               [self configureNav];     [self configurePortraitPlayerView];     [self setupLandScapeControlViewView];     [self configureAudioUI];

} - (void)configureNav {     WS(weakself)     _backButton = [UIButton buttonWithType:UIButtonTypeCustom];     [self.view addSubview:_backButton];     //    _backButton.frame = CGRectMake(0,kStatusBarH, kUIFitSize(50), kUIFitSize(40));     [_backButton mas_makeConstraints:^(MASConstraintMaker *make) {         make.left.equalTo(@15);         make.top.equalTo(@(kStatusBarH+5));     }];     [_backButton setImage:[UIImage imageNamed:@"back_arrow"] forState:UIControlStateNormal];     [_backButton setImage:[UIImage imageNamed:@"back_arrow"] forState:UIControlStateHighlighted];     [_backButton addTapGesture:^{         [weakself backActionAction];     }];     _backButton.backgroundColor = kUIColorFromRGBA(0x000000, 0.35);     _backButton.layer.cornerRadius = kUIFitSize(12.5);     _backButton.layer.masksToBounds = YES;     self.controlView.portraitControlView.slider.minimumTrackTintColor = kUIColorFromRGB(0x0085FE); } #pragma mark 点击去评价 - (void)jumpToEvalueate {     self.isPresent = @"1"; } #pragma mark  弹出评价之后去处理 #pragma mark- LCerBuySucceedViewDelegate 去评价 - (void)beginBtnAction {     LMSNewEvaluateVC *evaluateVC = [[LMSNewEvaluateVC alloc]init];     evaluateVC.detailModel = self.detailModel;     [self.navigationController pushViewController:evaluateVC animated:YES];     [[NSNotificationCenter defaultCenter] postNotificationName:KJumpToEvaluate object:nil];     NSLog(@"LMSNewLearnJoinDetailVC点击了去评价按钮"); } - (void)configurePortraitPlayerView {     WS(weskself)     UIView *maskView = [[UIView alloc]init];     [self.controlView.portraitControlView.topToolView addSubview:maskView];     maskView.backgroundColor = [UIColor blackColor];     maskView.alpha = 0.3;     maskView.frame = CGRectMake(0, 0, SCREEN_WIDTH, kStatusBarH+35);     UIButton *downLoadBtn= [UIButton buttonWithType:UIButtonTypeCustom];     [downLoadBtn setImage:[UIImage imageNamed:@"ic_xz_sb"] forState:UIControlStateNormal]; //    [self.controlView.portraitControlView.topToolView addSubview:downLoadBtn];     downLoadBtn.frame = CGRectMake(kUIScreenWidth-60, kStatusBarH-2, 40, 40);

    [downLoadBtn addTapGesture:^{         NSLog(@"下载按钮触发");         weskself.isPresent = @"1";         [MobClick event:@"v4_ios_learn_download"]; #pragma mark-----下载视频跳转         if([[NSUserDefaults standardUserDefaults] boolForKey:kSettingIsUseDataWatchCourse] == NO && [AFNetworkReachabilityManager sharedManager].isReachableViaWWAN) {//蜂窝网络且不允许流量下载             [weskself WWANNetworkingDownloadAler];         } else {             LMSNDownloadMenuViewContorller *vc = [[LMSNDownloadMenuViewContorller alloc] initWithModel:weskself.detailModel courType:weskself.urlStr];             vc.catcheManageClouse = ^{                 LMSNMyDownloadVC *vc = [LMSNMyDownloadVC new];                 [weskself.navigationController pushViewController:vc animated:false];             };             LNavigationViewController *nav = [[LNavigationViewController alloc] initWithRootViewController:vc];             nav.modalPresentationStyle = UIModalPresentationFullScreen;             [weskself presentViewController:nav animated:false completion:nil];         }     }];      //    [self.controlView.portraitControlView.downLoadBtn setImage:[UIImage imageNamed:@"ic_xz_sb"] forState:UIControlStateNormal]; //    [self.controlView.portraitControlView.downLoadBtn addTapGesture:^{ //        NSLog(@"下载按钮触发"); //        weskself.isPresent = @"1"; //        [MobClick event:@"v4_ios_learn_download"]; //#pragma mark-----下载视频跳转 //        if([[NSUserDefaults standardUserDefaults] boolForKey:kSettingIsUseDataWatchCourse] == NO && [AFNetworkReachabilityManager sharedManager].isReachableViaWWAN) {//蜂窝网络且不允许流量下载 //            [weskself WWANNetworkingDownloadAler]; //        } else { //            LMSNDownloadMenuViewContorller *vc = [[LMS`NDownloadMenuViewContorller alloc] initWithModel:weskself.detailModel courType:weskself.urlStr]; //            vc.catcheManageClouse = ^{ //                LMSNMyDownloadVC *vc = [LMSNMyDownloadVC new]; //                [weskself.navigationController pushViewController:vc animated:false]; //            }; //            [weskself presentViewController:vc animated:false completion:nil]; //        } //    }];` //    [self.controlView.portraitControlView.rateBtn setImage:[UIImage imageNamed:@"ic_bs_one"] forState:UIControlStateNormal]; //    [self.controlView.portraitControlView.rateBtn setTitle:@"" forState:UIControlStateNormal]; //    self.controlView.portraitControlView.rateBtn.hidden = YES;//隐藏竖版倍速播放     UIButton * listeningBtn = [UIButton buttonWithType:UIButtonTypeCustom];     //    listeningBtn.hidden = YES;//隐藏音频按钮     [listeningBtn setImage:[UIImage imageNamed:@"ic_ej"] forState:UIControlStateNormal];     [listeningBtn addTarget:self action:@selector(listeningBtnClick:) forControlEvents:UIControlEventTouchUpInside];      //    [self.controlView.portraitControlView.topToolView addSubview:listeningBtn];          listeningBtn.frame = CGRectMake(kUIScreenWidth-100, kStatusBarH-2, 40, 40); //    self.controlView.portraitControlView.resolutionBtn.hidden = YES;          [self.controlView.portraitControlView.fullScreenBtn setImage:[UIImage imageNamed:@"ic_qp"] forState:UIControlStateNormal];     self.controlView.portraitControlView.playOrPauseBtn.frame = CGRectMake(100, 100, 100, 100);     self.controlView.portraitControlView.slider.frame = CGRectMake(   self.controlView.portraitControlView.playOrPauseBtn.x+150, 100, 100, 10);     //    [self.controlView.portraitControlView.rateBtn addTapGesture:^{     //     //        NSLog(@"竖版倍速设置等待开发");     //    }];     [self.view addSubview:listeningBtn];     [self.view addSubview:downLoadBtn];     [self.view bringSubviewToFront:self.backButton]; } - (void)setupLandScapeControlViewView {          self.controlView.landScapeControlView.titleLabel.text = self.detailModel.course_title; //    self.controlView.landScapeControlView.rateBtn.hidden = YES; //    self.controlView.landScapeControlView.resolutionBtn.hidden = YES; //    self.controlView.landScapeControlView.resolutionView.hidden = YES; //    self.controlView.landScapeControlView.downLoadBtn.hidden = YES;     self.controlView.landScapeControlView.slider.frame = CGRectMake(100, 100, 100, 100);     self.controlView.landScapeControlView.playOrPauseBtn.frame = CGRectMake(100, 100, 100, 100);     [self.controlView.landScapeControlView.backBtn setImage:[UIImage imageNamed:@"ic_back"] forState:UIControlStateNormal];     //待会改成音频  横版没有音频     //    UIButton * listeningLanscapeBtn = [UIButton buttonWithType:UIButtonTypeCustom];     //    listeningLanscapeBtn.frame = CGRectMake(kUIScreenHeight-kUIFitSize(110), kUIFitSize(15), kUIFitSize(35), kUIFitSize(35));     //    [listeningLanscapeBtn setImage:[UIImage imageNamed:@"ic_ej"] forState:UIControlStateNormal];     //    [listeningLanscapeBtn addTarget:self action:@selector(listeningBtnClick) forControlEvents:UIControlEventTouchUpInside];     //    [self.controlView.landScapeControlView.topToolView addSubview:listeningLanscapeBtn];          UIButton * resolutionBtn = [UIButton buttonWithType:UIButtonTypeCustom];     resolutionBtn.frame = CGRectMake(kUIScreenHeight-kUIFitSize(60), kUIFitSize(15), kUIFitSize(55), kUIFitSize(35));     [resolutionBtn setTitle:@"流畅" forState:UIControlStateNormal];     resolutionBtn.titleLabel.font = [UIFont systemFontOfSize:15];     [resolutionBtn addTarget:self action:@selector(resolutionBtnClick) forControlEvents:UIControlEventTouchUpInside];     [self.controlView.landScapeControlView.topToolView addSubview:resolutionBtn];     self.resolutionLandscapeBtn = resolutionBtn;          //todo  作者说布局写在内部的layousubviews,需要自己fork一份控制层代码,然后修改,但是因为还要兼容之前线上的现有版本,所以不可行,等换新的ZF的时候就可以自定义和修改了     //    UIButton * nextBtn = [UIButton buttonWithType:UIButtonTypeCustom];     //    nextBtn.frame = CGRectMake(45, 35, 0, kUIFitSize(25));     //    [nextBtn setImage:[UIImage imageNamed:@"ic_xh"] forState:UIControlStateNormal];     //    [nextBtn addTarget:self action:@selector(nextBtnClick) forControlEvents:UIControlEventTouchUpInside];     //    [self.controlView.landScapeControlView.bottomToolView addSubview:nextBtn];                         UIButton * rateBtn = [UIButton buttonWithType:UIButtonTypeCustom];     rateBtn.frame = CGRectMake(kUIScreenHeight - kUIFitSize(50),100, kUIFitSize(40), kUIFitSize(25));     [rateBtn setTitle:@"1.0X" forState:UIControlStateNormal];     rateBtn.titleLabel.font = SystemFont(kUIFitSize(15));     [rateBtn addTarget:self action:@selector(rateBtnClick) forControlEvents:UIControlEventTouchUpInside];     [self.controlView.landScapeControlView addSubview:rateBtn];     self.rateLanscapeBtn = rateBtn;          //    UIButton * courseBtn = [UIButton buttonWithType:UIButtonTypeCustom];     //    courseBtn.frame = CGRectMake(kUIScreenHeight-kUIFitSize(50),100+40, kUIFitSize(40), kUIFitSize(25));     //    [courseBtn setTitle:@"章节" forState:UIControlStateNormal];     //    courseBtn.backgroundColor = kUIColorFromRGBA(0x000000, 0.35);     //    courseBtn.layer.masksToBounds = YES;     //    courseBtn.titleLabel.font = SystemFont(kUIFitSize(15));     //    [courseBtn addTarget:self action:@selector(courseBtnClick) forControlEvents:UIControlEventTouchUpInside];     //    [self.controlView.landScapeControlView addSubview:courseBtn];     //    courseBtn.backgroundColor = [UIColor clearColor];     //    self.landscapeCourseBtn = courseBtn;          [self.controlView.landScapeControlView addSubview:self.rateSuperView];     [self.controlView.landScapeControlView addSubview:self.resolutionSuperView];     [self.controlView.landScapeControlView addSubview:self.courseSuperView];     [self.courseSuperView addSubview:self.listTableView];     self.courseSuperView.hidden = YES;     [self.view bringSubviewToFront:self.courseSuperView];     //    [self.controlView.landScapeControlView addSubview:self.moreSuperView];           } - (void)backActionAction {     [self.navigationController popViewControllerAnimated:YES];     self.isPresent = @"0";     self.player.viewControllerDisappear = YES;     [self pauseTimer];     [self removeTimerFromSelf];          self.player.pauseWhenAppResignActive = YES;     self.player.pauseByEvent = YES;     [self.player.currentPlayerManager pause];     [self.player stop];     [self.moviePlayerView removeFromSuperview];     self.moviePlayerView = nil;          [self.player.currentPlayerManager stop];     self.player = nil;      } #pragma mark  进入音频 - (void)listeningBtnClick:(UIButton *)sender {       [MobClick event:@"v4_ios_learn_audio"];     if (self.currentLearnModel.mp3_url.length) {         [self listeningBtn:self.currentLearnModel];             }     else     {         [MBProgressHUD showText:@"当前课程没有音频哦"];     }      } - (void)listeningBtn:(LMSNewLectureModel *)model {     self.listeningV416View.frame = CGRectMake(0, 0, kUIScreenWidth, kUIFitSize(192));     self.player.assetURL = [NSURL URLWithString:model.mp3_url];     self.audioTitleLabel.text = self.currentLearnModel.lecture_title;     if ([self.urlStr containsString:@"company-course"]) {//自制课程         if (model.progress.intValue>95) {         }         else         {             NSInteger lastSexond = [model.last_learn integerValue];             [self.playerManager seekToTime:lastSexond completionHandler:nil];         }     } else {//先之课程         if ((model.lecture_length.intValue - model.last_learn.intValue)>10) {             NSInteger lastSexond = [model.last_learn integerValue];             [self.playerManager seekToTime:lastSexond completionHandler:nil];         }     }     self.listeningV416View.hidden = false;     [self.listeningV416View bringSubviewToFront:self.listeningV416bgImageV];     self.controlView.portraitControlView.currentTimeLabel.frame = CGRectMake(0, kUIFitSize(192)-40, 100, 24);     self.controlView.portraitControlView.totalTimeLabel.frame = CGRectMake(kUIScreenWidth-100, kUIFitSize(192)-40, 70, 24);     self.controlView.portraitControlView.slider.frame = CGRectMake(90,  kUIFitSize(192)-40, kUIScreenWidth-180, 24);;     [self.listeningV416View addSubview:self.controlView.portraitControlView.currentTimeLabel];     [self.listeningV416View addSubview:self.controlView.portraitControlView.totalTimeLabel];     [self.listeningV416View addSubview:self.controlView.portraitControlView.slider];     [self.listeningV416View bringSubviewToFront:self.controlView.portraitControlView.slider];     [self.listeningV416View bringSubviewToFront:self.controlView.portraitControlView.currentTimeLabel];     [self.listeningV416View bringSubviewToFront:self.controlView.portraitControlView.totalTimeLabel];     self.player.pauseWhenAppResignActive = false;     self.isPlay = @"1";

//    [self.view setNeedsLayout]; // //    [self.view layoutIfNeeded]; } - (void)viewDidLayoutSubviews {     [super viewDidLayoutSubviews];     NSLog(@"___________%@",self.controlView.portraitControlView.slider);      } #pragma mark  音频播放 - (void)yinpinnextNoti {     NSInteger index = 0;     for (int i = 0; i <self.allListAry.count; i++) {         LMSNewLectureModel *lectModel = self.allListAry[i];         if ([self.currentLearnModel.lecture_id isEqualToString:lectModel.lecture_id]) {             index = i;         }     }               if (index != self.allListAry.count - 1) {         self.currentLearnModel.isLearning = NO;         LMSNewLectureModel *currentModel = self.allListAry[index + 1];         currentModel.isLearning = YES;         NSDictionary *dic = [self onereturnToDictionaryWithModel:currentModel];         [[NSNotificationCenter defaultCenter]postNotificationName:KChangeNextPlay object:dic];         //            self.player.assetURL = [NSURL URLWithString:currentModel.mp4_url];         [[NSNotificationCenter defaultCenter] postNotificationName:KChangeReallyJiangyiNotifition object:dic];         if (currentModel.mp3_url.length) {             [self listeningBtn:currentModel];         }         else   if (currentModel.mp4_url.length) {             self.listeningV416View.hidden = YES;             self.player.assetURL = [NSURL URLWithString:currentModel.mp4_url];             if ([self.urlStr containsString:@"company-course"]) {//自制课程                 if (currentModel.progress.intValue>95) {                 }                 else                 {                     NSInteger lastSexond = [currentModel.last_learn integerValue];                     [self.playerManager seekToTime:lastSexond completionHandler:nil];                 }             } else {//先之课程                 if ((currentModel.lecture_length.intValue - currentModel.last_learn.intValue)>10) {                     NSInteger lastSexond = [currentModel.last_learn integerValue];                     [self.playerManager seekToTime:lastSexond completionHandler:nil];                 }             }                         return;         }         else  if (currentModel.document_id.length) {             self.isPresent = @"1";             [self pauseTimer];             [self.player.currentPlayerManager pause];             LMSNewBaiduReaderVC *baiduVC = [[LMSNewBaiduReaderVC alloc]init];             baiduVC.lectureModel = currentModel;             baiduVC.detailModel = self.detailModel;             [self.navigationController pushViewController:baiduVC animated:YES];         }         else   if (currentModel.link.length) {             self.isPresent = @"1";             [self pauseTimer];             [self.player.currentPlayerManager pause];             LMSNewWebVC *webVC = [[LMSNewWebVC alloc] init];              webVC.urlStr = currentModel.link;              webVC.titleStr = @"课程详情";             [self acqucireRecordServiceProgress:100 curpage:0];             [self.navigationController pushViewController:webVC animated:YES];         }         else         {             [MBProgressHUD showText:@"没有对应的视频文件"];         }         currentModel.isLearning = YES;         self.currentLearnModel = currentModel;                  [self.controlView showTitle:currentModel.lecture_title coverURLString:@"https://f3-md.veimg.cn/meadincms/1/2018/0104/151455928.jpg" fullScreenMode:SZFullScreenModeLandscape];         //            [self changeModel];//这是云课堂的置顶,这个里面暂时不需要     }else{//没有下一节了         //        [self.player stop];         //            self.replaytestlandView.hidden = false;         //            self.replaytestPorView.hidden = false;         //            [self.controlView.landScapeControlView bringSubviewToFront:self.replaytestlandView];         [MBProgressHUD showText:@"这已经是最后一节了" duration:2];     } } - (void)yinpinPrexNoti {     NSInteger index = 0;     for (int i = 0; i <self.allListAry.count; i++) {         LMSNewLectureModel *lectModel = self.allListAry[i];         if ([self.currentLearnModel.lecture_id isEqualToString:lectModel.lecture_id]) {             index = i;         }     }               if (index != 0) {         self.currentLearnModel.isLearning = NO;         LMSNewLectureModel *currentModel = self.allListAry[index - 1];         currentModel.isLearning = YES;         NSDictionary *dic = [self onereturnToDictionaryWithModel:currentModel];         [[NSNotificationCenter defaultCenter]postNotificationName:KChangeNextPlay object:dic];         [[NSNotificationCenter defaultCenter] postNotificationName:KChangeReallyJiangyiNotifition object:dic];                  if (currentModel.mp4_url.length) {             self.player.assetURL = [NSURL URLWithString:currentModel.mp4_url];                 if ([self.urlStr containsString:@"company-course"]) {//自制课程                         if (currentModel.progress.intValue>95) {                         }                         else                         {                             NSInteger lastSexond = [currentModel.last_learn integerValue];                                        [self.playerManager seekToTime:lastSexond completionHandler:nil];                         }                     } else {//先之课程                         if ((currentModel.lecture_length.intValue - currentModel.last_learn.intValue)>10) {                               NSInteger lastSexond = [currentModel.last_learn integerValue];                              [self.playerManager seekToTime:lastSexond completionHandler:nil];                         }                     }             return;         }         if (currentModel.mp3_url.length) {             [self listeningBtn:currentModel];         }         if (currentModel.document_id.length) {             self.isPresent = @"1";             [self pauseTimer];             [self.player.currentPlayerManager pause];             LMSNewBaiduReaderVC *baiduVC = [[LMSNewBaiduReaderVC alloc]init];             baiduVC.lectureModel = currentModel;             baiduVC.detailModel = self.detailModel;             [self.navigationController pushViewController:baiduVC animated:YES];         }         if (currentModel.link.length) {             self.isPresent = @"1";             [self pauseTimer];             [self.player.currentPlayerManager pause];             LMSNewWebVC *webVC = [[LMSNewWebVC alloc] init];              webVC.urlStr = currentModel.link;              webVC.titleStr = @"课程详情";              [self acqucireRecordServiceProgress:100 curpage:0];             [self.navigationController pushViewController:webVC animated:YES];         }         currentModel.isLearning = YES;         self.currentLearnModel = currentModel;         [self.controlView showTitle:currentModel.lecture_title coverURLString:@"https://f3-md.veimg.cn/meadincms/1/2018/0104/151455928.jpg" fullScreenMode:SZFullScreenModeLandscape];         //            [self changeModel];//这是云课堂的置顶,这个里面暂时不需要     }else{//没有下一节了         //        [self.player stop];         //            self.replaytestlandView.hidden = false;         //            self.replaytestPorView.hidden = false;         //            [self.controlView.landScapeControlView bringSubviewToFront:self.replaytestlandView];         [MBProgressHUD showText:@"这就是第一节" duration:2];     } } - (void)changeCurrentModel {      } #pragma mark - 播放下一节(自动播放 || 手动点击) -(void)playNext{     ///TODO:播放下一节          NSInteger index = 0;     for (int i = 0; i <self.allListAry.count; i++) {         LMSNewLectureModel *lectModel = self.allListAry[i];         if ([self.currentLearnModel.lecture_id isEqualToString:lectModel.lecture_id]) {             index = i;         }     }               if (index != self.allListAry.count - 1) {         self.currentLearnModel.isLearning = NO;         LMSNewLectureModel *currentModel = self.allListAry[index + 1];         currentModel.isLearning = YES;         NSDictionary *dic = [self onereturnToDictionaryWithModel:currentModel];         [[NSNotificationCenter defaultCenter]postNotificationName:KChangeNextPlay object:dic];         //            self.player.assetURL = [NSURL URLWithString:currentModel.mp4_url];                  if ([self.player.assetURL.absoluteString containsString:@".mp3"]||[self.player.assetURL.absoluteString containsString:@".mp4"]) {             if ([self.player.assetURL.absoluteString containsString:@".mp4"]) {                 if (currentModel.mp4_url.length) {                     self.player.assetURL = [NSURL URLWithString:currentModel.mp4_url];                     self.listeningV416View.hidden = YES;                                      }                 else  {                     [self listeningBtn:currentModel];                     self.listeningV416View.hidden = false;                     self.playerManager.rate = 1;                 }             }             else             {                                  if (currentModel.mp3_url.length) {                     [self listeningBtn:currentModel];                     self.listeningV416View.hidden = false;                     self.playerManager.rate = 1;                 }                 else  {                     self.player.assetURL = [NSURL URLWithString:currentModel.mp4_url];                     self.listeningV416View.hidden = YES;                                      }             }         }         if (currentModel.document_id.length) {             self.isPresent = @"1";             [self pauseTimer];             [self.player.currentPlayerManager pause];             LMSNewBaiduReaderVC *baiduVC = [[LMSNewBaiduReaderVC alloc]init];             baiduVC.lectureModel = currentModel;             baiduVC.detailModel = self.detailModel;             [self.navigationController pushViewController:baiduVC animated:YES];         }         if (currentModel.link.length) {                   self.isPresent = @"1";                   [self pauseTimer];                   [self.player.currentPlayerManager pause];                   LMSNewWebVC *webVC = [[LMSNewWebVC alloc] init];                    webVC.urlStr = currentModel.link;                    webVC.titleStr = @"课程详情";              [self acqucireRecordServiceProgress:100 curpage:0];                   [self.navigationController pushViewController:webVC animated:YES];               }         if ([self.urlStr containsString:@"company-course"]) {//自制课程             if (currentModel.progress.intValue>95) {             }             else             {                 NSInteger lastSexond = [currentModel.last_learn integerValue];                 [self.playerManager seekToTime:lastSexond completionHandler:nil];             }         } else {//先之课程             if ((currentModel.lecture_length.intValue - currentModel.last_learn.intValue)>10) {                 NSInteger lastSexond = [currentModel.last_learn integerValue];                 [self.playerManager seekToTime:lastSexond completionHandler:nil];             }         }         currentModel.isLearning = YES;         self.currentLearnModel = currentModel;         [self.controlView showTitle:currentModel.lecture_title coverURLString:@"https://f3-md.veimg.cn/meadincms/1/2018/0104/151455928.jpg" fullScreenMode:SZFullScreenModeLandscape];         //            [self changeModel];//这是云课堂的置顶,这个里面暂时不需要     }else{//没有下一节了         //        [self.player stop];         //            self.replaytestlandView.hidden = false;         //            self.replaytestPorView.hidden = false;         //            [self.controlView.landScapeControlView bringSubviewToFront:self.replaytestlandView];         [MBProgressHUD showText:@"这已经是最后一节了" duration:2];     }

     } #pragma mark - Timer

-(void)addTimerInSelf {     self.timer = [NSTimer scheduledTimerWithTimeInterval:1 target:[WeakProxy proxyWithTarget:self] selector:@selector(timerScroll) userInfo:nil repeats:YES];      }

-(void)beginTimer {     if (self.timer != nil)     {         [self.timer setFireDate:[NSDate distantPast]];     } }

-(void)timerScroll {     if (self.timer != nil)     {         self.viewTime ++;         if (self.viewTime >0 && self.viewTime%(self.detailModel.study_configModel.cheating_time.intValue) == 0) {             switch (self.player.isFullScreen) {                 case 0:                 {                     if ([self.player.assetURL.absoluteString hasSuffix:@"mp3"]) {                         [self.startAudioBtn setImage:[UIImage imageNamed:@"ic_bf_yp"] forState:UIControlStateNormal];                      }                     [self portraitcheatingtimeAction];                 }                                          break;                                      default:                 {                     [self lanscapecheatingtimeAction];                 }                     break;             }             [self pauseTimer];             [self.player.currentPlayerManager pause];         }                           if (self.viewTime > 0 && self.viewTime % 120 == 0) {             // 每2分钟保存一次进度             [self acquireSecondToSaveIsPop:NO];         }         if (self.viewTime > 0 && self.viewTime % 60 == 0) {                // 每1分钟保存一次时长             [self acquireSecondToSaveTotolTimeIsPop:NO];            }     }     MyLog(@"%zi", self.viewTime);      } - (void)portraitcheatingtimeAction {     WS(weakself)     UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0,0, 0)];          JKAlertView *alertView = [JKAlertView alertViewWithTitle:@"您还在线吗" message:@"" style:(JKAlertStylePlain)];          // 显示title和message之间的分隔线     alertView.setPlainTitleMessageSeparatorHidden(NO, 0);          // 设置YES表示仅自定义message     alertView.setCustomPlainTitleView(YES, ^UIView *(JKAlertView *view) {                  return label;     });     [alertView addAction:[JKAlertAction actionWithTitle:@"继续播放" style:(JKAlertActionStyleDefault) handler:^(JKAlertAction *action) {              }]];          alertView.enableDeallocLog(YES).show().setDismissComplete(^{                           dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.75 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{             [weakself beginTimer];             [weakself.player.currentPlayerManager play];             if ([weakself.player.assetURL.absoluteString hasSuffix:@"mp3"]) {                 [weakself.startAudioBtn  setImage:[UIImage imageNamed:@"ic_yp_bf"] forState:UIControlStateNormal];             }                      });     }); } - (void)lanscapecheatingtimeAction {     WS(weakself)     UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0,0, 0)];     //    //    label.backgroundColor = [UIColor orangeColor];     //    label.textAlignment = NSTextAlignmentCenter;     //    label.text = @"我是自定义的view~~";     //    label.attributedText = [[NSAttributedString alloc] initWithString:@"我是自定义的view~~" attributes:@{NSForegroundColorAttributeName : [UIColor redColor]}];          JKAlertView *alertView = [JKAlertView alertViewWithTitle:@"您还在线吗" message:@"" style:(JKAlertStylePlain)];          // 显示title和message之间的分隔线     alertView.setPlainTitleMessageSeparatorHidden(NO, 0);          // 设置YES表示仅自定义message     alertView.setCustomPlainTitleView(YES, ^UIView *(JKAlertView *view) {                  return label;     });     UIView *linshiView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT)];     linshiView.transform = CGAffineTransformMakeRotation(M_PI/2);     [[UIApplication sharedApplication].keyWindow addSubview:linshiView];     linshiView.frame = CGRectMake(0, 0, SCREEN_HEIGHT,SCREEN_WIDTH );     alertView.setCustomSuperView(linshiView);     [alertView addAction:[JKAlertAction actionWithTitle:@"继续播放" style:(JKAlertActionStyleDefault) handler:^(JKAlertAction *action) {              }]];          alertView.enableDeallocLog(YES).show().setDismissComplete(^{                  dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.75 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{             [weakself beginTimer];             [weakself.player.currentPlayerManager play];             [linshiView removeFromSuperview];         });     }); } -(void)pauseTimer {     if (self.timer != nil)     {         [self.timer setFireDate:[NSDate distantFuture]];     } }

-(void)removeTimerFromSelf {     if (self.timer != nil)     {         [self.timer invalidate];         self.timer= nil;     } }

#pragma mark - UIApplication Notification Handle

- (void)applicationWillEnterForeground:(NSNotification *)notification { #ifdef DEBUG     MyLog(@"%s",__PRETTY_FUNCTION__); #endif          [self beginTimer];     MyLog(@" +++ %ld",(long)self.viewTime); }

- (void)applicationDidEnterBackground:(NSNotification *)notification { #ifdef DEBUG     MyLog(@"%s",__PRETTY_FUNCTION__); #endif          [self acquireSecondToSaveIsPop:NO];          [self pauseTimer];     MyLog(@" --- %ld",(long)self.viewTime); }

- (UIStatusBarStyle)preferredStatusBarStyle {     if (self.player.isFullScreen) {         return UIStatusBarStyleLightContent;     }     return UIStatusBarStyleDefault; }

- (BOOL)prefersStatusBarHidden {     return self.player.isStatusBarHidden; }

- (UIStatusBarAnimation)preferredStatusBarUpdateAnimation {     return UIStatusBarAnimationSlide; }

- (BOOL)shouldAutorotate {     return self.player.shouldAutorotate; } // 返回值要必须为YES //- (BOOL)shouldAutorotate { //    return YES; //} //支持的方向 - (UIInterfaceOrientationMask)supportedInterfaceOrientations {     if (self.player.isFullScreen) {         return UIInterfaceOrientationMaskLandscape;     }     return UIInterfaceOrientationMaskPortrait; }

- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {

    [self.view endEditing:YES]; } //保存播放进度 -(void)acquireSecondToSaveIsPop:(BOOL)isPop {     WS(weakSelf);     //获取已经播放的时间     NSTimeInterval currentTimeSec = self.player.currentTime;     //获取已经播放的时间     NSTimeInterval totalTimeSec = self.player.totalTime;     //todowh注释掉之前的 准备写保存进度     //        if (_course.course_type == 1) {//先之课程     //            [self savePlayRecord:currentTimeSec     //                         lecture:self.currentLearnModel     //                        complete:^{     //                            [MBProgressHUD hideHUDForView:weakSelf.view animated:YES];     //                            if (isPop == YES)     //                            {     //                                [weakSelf.navigationController popViewControllerAnimated:YES];     //                            }     //                        }];     //        }else{     //     //            [self updateSelfCoursePlayRecordWithPlaytime:currentTimeSec totalTime:totalTimeSec ispop:isPop];     //        }     NSInteger progress =ceil((currentTimeSec / totalTimeSec)*100);     NSInteger current = round(currentTimeSec);     [self acqucireRecordServiceProgress:progress curpage:current];   } //保存播放时长 -(void)acquireSecondToSaveTotolTimeIsPop:(BOOL)isPop {     WS(weakSelf);     //获取已经播放的时间     NSTimeInterval currentTimeSec = self.player.currentTime;     //获取已经播放的时间     NSTimeInterval totalTimeSec = self.player.totalTime;     NSInteger progress =ceil((currentTimeSec / totalTimeSec)*100);     NSInteger current = round(currentTimeSec);     [self acqutireTimeRecordLast_learn:current];      } #pragma mark - - (void)segmentStyle {     WS(weakself)          self.segHead = [[MLMSegmentHead alloc] initWithFrame:CGRectMake(0, kUIFitSize(192), kUIScreenWidth, SEGMENTHEIGHT) titles:self.titleAry headStyle:SegmentHeadStyleLine layoutStyle:MLMSegmentLayoutDefault];     self.segHead.fontScale = 1.0;     self.segHead.deSelectColor =RGBAColor(9, 21, 34, 0.85);     self.segHead.selectColor = kUIColorFromRGB(0x0085FE);     self.segHead.lineColor = kUIColorFromRGB(0x0085FE);     self.segHead.headColor = [UIColor whiteColor];     self.segHead.lineHeight = 2;     self.segHead.lineScale = 0.5;     self.segScroll = [[MLMSegmentScroll alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(self.segHead.frame)+SEGMENTHEIGHT-ADJUSTHEIGHT, kUIScreenWidth, kUIScreenHeight-CGRectGetMaxY(self.segHead.frame)-SEGMENTHEIGHT+kStatusBarH) vcOrViews:[self vcArr:self.keysAry]];//     self.segScroll.loadAll = YES;     [MLMSegmentManager associateHead:self.segHead withScroll:self.segScroll completion:^{         [weakself.view addSubview:weakself.segHead];         [weakself.view addSubview:weakself.segScroll];     }];     //    self.view.backgroundColor = [UIColor redColor];      }

#pragma mark 接受学习通知 - (void)kaishixuexiNoti {     [self acquireReloadNetWorking];     [self.segHead setSelectIndex:1];     [self.segScroll setShowIndex:1];      }

#pragma mark - 数据源 - (NSArray *)vcArr:(NSArray *)keysAry {          NSMutableArray *arr = [NSMutableArray array];     if ([self.urlStr containsString:@"company-course"]) {         for (NSInteger i = 1; i <= 3; i ++) {             if (i == 1) {                 LMSNewLearnJoinDetailVC *investVC = [[LMSNewLearnJoinDetailVC alloc]init];                 investVC.detailModel = self.detailModel ;                 [arr addObject:investVC];             }             if (i == 2) {                 LMSNewClassLearnCatalogVC *planVC = [[LMSNewClassLearnCatalogVC alloc]initWithNibName:@"LMSNewClassLearnCatalogVC" bundle:nil];                 planVC.chapterArray = self.detailModel.chapterMArr;                 planVC.allLectureList = self.allListAry;                 planVC.currectModel = self.currentLearnModel;                 planVC.detailModel = self.detailModel;                 [arr addObject:planVC];             }                      }     } else {         for (NSInteger i = 1; i <= 3; i ++) {             if (i == 1) {                 LMSNewLearnJoinDetailVC *investVC = [[LMSNewLearnJoinDetailVC alloc]init];                 investVC.isMadeByXianzhi = YES;                 investVC.detailModel = self.detailModel ;                 [arr addObject:investVC];             }             if (i == 2) {                 LMSNewClassLearnCatalogVC *planVC = [[LMSNewClassLearnCatalogVC alloc]initWithNibName:@"LMSNewClassLearnCatalogVC" bundle:nil];                 planVC.chapterArray = self.detailModel.chapterMArr;                 planVC.allLectureList = self.allListAry;                 planVC.currectModel = self.currentLearnModel;                 planVC.detailModel = self.detailModel;                 [arr addObject:planVC];             }             if (i == 3)             {                 LMSNewClassLearnJiangyiVCViewController *jiangyiVC = [[LMSNewClassLearnJiangyiVCViewController alloc]init];                 jiangyiVC.introduce = self.detailModel.introduce;                 jiangyiVC.detailModel = self.detailModel;                 [arr addObject:jiangyiVC];                 [MobClick event:@"v4_ios_learn_handout"];             }         }     }               return arr; } - (void)didReceiveMemoryWarning {     [super didReceiveMemoryWarning];     // Dispose of any resources that can be recreated. } #pragma mark------获取课程详情 - (void)handleService {     WS(weakself)     NSDictionary *parameters = @{@"token":kUserToken                                                                    };     //todo @"client/plan/course/21676"     WS(weakSelf)     [[LMSNewAPIClient apiManager] getRequestAPI:[NSString stringWithFormat:@"%@%@",self.urlStr,self.relationID] parameters:parameters success:^(NSURLSessionDataTask *dataTask, id JSON) {         MyLog(@"%@", JSON);         weakself.detailModel = [LMSNewLearnDetailModel mj_objectWithKeyValues:JSON[@"data"]];         if([weakself.detailModel.chapterMArr.firstObject isNotNullOrEmpty] == NO) {             //            return;         }         weakself.detailModel.chapterModel = weakself.detailModel. chapterMArr.firstObject;         [weakself segmentStyle];                  //        [self addDownloadTask:self.detailModel]; //                  for (int i = 0; i <self.detailModel.chapterMArr.count; i++) {             LMSNewLectureChapterModel *chapModel = weakself.detailModel.chapterMArr[i];             for (int j = 0; j < chapModel.lectureMArr.count; j++) {                 if (chapModel.lectureMArr.count) {                     [self.allListAry addObject:chapModel.lectureMArr[j]];                 }             }         }         self.currentLearnModel = self.allListAry.count > 0 ? self.allListAry[0] : nil;         [self.moviePlayerView sd_setImageWithURL:[NSURL URLWithString:self.detailModel.course_picture] placeholderImage:[UIImage imageNamed:@"videoCoverImage"]];         if ([self.fromType isEqualToString:KPlayLastLearn]) {             [[NSNotificationCenter defaultCenter] postNotificationName:KPlayLastLearn object:nil];             [self.segHead setSelectIndex:1];             [self.segScroll setShowIndex:1];         }                  if([JSON[@"status"] integerValue] == 1) {             if(weakSelf.isShowDownloadMore) {//下载更多展示                 weakSelf.isPresent = @"1";                 if([[NSUserDefaults standardUserDefaults] boolForKey:kSettingIsUseDataWatchCourse] == NO && [AFNetworkReachabilityManager sharedManager].isReachableViaWWAN) {//蜂窝网络且不允许流量下载                     [weakSelf WWANNetworkingDownloadAler];                 } else {                     LMSNDownloadMenuViewContorller *vc = [[LMSNDownloadMenuViewContorller alloc] initWithModel:weakSelf.detailModel courType:weakSelf.urlStr];                     vc.catcheManageClouse = ^{                                                  LMSNMyDownloadVC *vc = [LMSNMyDownloadVC new];                         [weakSelf.navigationController pushViewController:vc animated:false];                     };                     LNavigationViewController *nav = [[LNavigationViewController alloc] initWithRootViewController:vc];                     nav.modalPresentationStyle = UIModalPresentationFullScreen;                     [weakSelf presentViewController:nav animated:false completion:nil];                 }             }         }     } failure:^(NSURLSessionDataTask *dataTask, NSError *error) {              }];      }

/*  #pragma mark - Navigation    // In a storyboard-based application, you will often want to do a little preparation before navigation  - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {  // Get the new view controller using [segue destinationViewController].  // Pass the selected object to the new view controller.  }  */ //#pragma mark -ZFLandScapeControlViewDelegate //- (void)ZFLandScapeControlViewDownloadVideoAction:(UIButton *)sender //{ //    [self ZFPortraitControlViewDownloadVideoAction:sender]; //} //- (void)ZFLandScapeControlViewResolutionAction:(UIButton *)sender //{ //    [self ZFPortraitControlViewresolutionAction:sender]; //} //- (void)ZFLandScapeControlViewRateAction:(UIButton *)sender //{ //    [self ZFPortraitControlViewRateAction:sender]; //}

- (SZPlayerControlView *)controlView {     if (!_controlView) {         _controlView = [SZPlayerControlView new]; //        _controlView.portraitControlView.delegate = self; //        _controlView.landScapeControlView.delegate = self;     }     return _controlView; } - (void)loadView {     [super loadView];     _moviePlayerView = [[UIImageView alloc]init];     [self.view addSubview:_moviePlayerView];     _moviePlayerView.frame = CGRectMake(0, 0, kUIScreenWidth, kUIFitSize(192));     //    _moviePlayerView.backgroundColor = [UIColor colorWithRed:170 / 255.0 green:170 / 255.0 blue:170 / 255.0 alpha:1.0];           } #pragma mark changePlayState - (void)changePlayState:(NSNotification *)sender {

         BOOL isnumber = [[NSUserDefaults standardUserDefaults] boolForKey:kSettingIsUseDataWatchCourse];     if (!isnumber) {         [self getCurrentNetworkState:sender];     }     else     {                  LMSNewLectureModel *learnModel = [LMSNewLectureModel mj_objectWithKeyValues:sender.object];         self.currentLearnModel = learnModel;         if (self.player.assetURL.absoluteString.length) {                      }         else         {               if (learnModel.mp4_url.length) {                        [self videoBtnClick];

                                    [self removeTimerFromSelf];                        [self addTimerInSelf];                        self.viewTime = 0;//初始化本次播放时间                                            }                    else    if (learnModel.mp3_url.length) {                        [self listeningBtn:learnModel];                        [self removeTimerFromSelf];                        [self addTimerInSelf];                        [self.startAudioBtn  setImage:[UIImage imageNamed:@"ic_yp_bf"] forState:UIControlStateNormal];                        self.isPlay = @"1";                        self.viewTime = 0;//初始化本次播放时间                    }                    else   if (learnModel.document_id.length) {                        self.isPresent = @"1";                        [self pauseTimer];                        [self.player.currentPlayerManager pause];                        LMSNewBaiduReaderVC *baiduVC = [[LMSNewBaiduReaderVC alloc]init];                        baiduVC.lectureModel = learnModel;                        baiduVC.detailModel = self.detailModel;                        [self.navigationController pushViewController:baiduVC animated:YES];                    }                    else   if (learnModel.link.length) {                        self.isPresent = @"1";                        [self pauseTimer];                        [self.player.currentPlayerManager pause];                        LMSNewWebVC *webVC = [[LMSNewWebVC alloc] init];                         webVC.urlStr = learnModel.link;                         webVC.titleStr = @"课程详情";                         [self acqucireRecordServiceProgress:100 curpage:0];                        [self.navigationController pushViewController:webVC animated:YES];                    }                    else                    {                        [MBProgressHUD showText:@"没有对应的视频文件"];                    }         }              }                          } - (void)getCurrentNetworkState:(NSNotification *)sender {     WS(weakself)     [[AFNetworkReachabilityManager sharedManager] startMonitoring];     [[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) {         switch (status) {             case -1:                 NSLog(@"未知网络");                 break;             case 0:                 NSLog(@"网络不可达");                 break;             case 1:             {                 NSLog(@"GPRS网络");                 [weakself inditatorLiuliangMethod:sender];                 [[NSNotificationCenter defaultCenter] postNotificationName:@"monitorNetworking" object:@"1" userInfo:nil];             }                 break;             case 2:             {                 NSLog(@"wifi网络");                 LMSNewLectureModel *learnModel = [LMSNewLectureModel mj_objectWithKeyValues:sender.object];                 weakself.currentLearnModel = learnModel;                 if (learnModel.mp4_url.length) {                     [weakself videoBtnClick];                                         weakself.player.assetURL = [NSURL URLWithString:learnModel.mp4_url];                                         weakself.player.pauseWhenAppResignActive = YES;                     if ([weakself.urlStr containsString:@"company-course"]) {//自制课程                         if (learnModel.progress.intValue>95) {                         }                         else                         {                             NSInteger lastSexond = [learnModel.last_learn integerValue];                             [weakself.playerManager seekToTime:lastSexond completionHandler:nil];                         }                     } else {//先之课程                         if ((learnModel.lecture_length.intValue - learnModel.last_learn.intValue)>10) {                             NSInteger lastSexond = [learnModel.last_learn integerValue];                             [weakself.playerManager seekToTime:lastSexond completionHandler:nil];                         }                     } //                    weakself.listeningV416View.hidden = YES;                     [weakself removeTimerFromSelf];                     [weakself addTimerInSelf];                     weakself.viewTime = 0;//初始化本次播放时间                                      }                 else    if (learnModel.mp3_url.length) {                     [weakself listeningBtn:self.currentLearnModel];                     [weakself removeTimerFromSelf];                     [weakself addTimerInSelf];                     [self.startAudioBtn  setImage:[UIImage imageNamed:@"ic_yp_bf"] forState:UIControlStateNormal];                      self.isPlay = @"1";                     weakself.viewTime = 0;//初始化本次播放时间                 }                 else   if (learnModel.document_id.length) {                     weakself.isPresent = @"1";                     [weakself pauseTimer];                     [weakself.player.currentPlayerManager pause];                     LMSNewBaiduReaderVC *baiduVC = [[LMSNewBaiduReaderVC alloc]init];                     baiduVC.lectureModel = learnModel;                     baiduVC.detailModel = weakself.detailModel;                     [weakself.navigationController pushViewController:baiduVC animated:YES];                 }                 else   if (learnModel.link.length) {                     weakself.isPresent = @"1";                     [weakself pauseTimer];                     [weakself.player.currentPlayerManager pause];                     LMSNewWebVC *webVC = [[LMSNewWebVC alloc] init];                      webVC.urlStr = learnModel.link;                      webVC.titleStr = @"课程详情";                      [weakself acqucireRecordServiceProgress:100 curpage:0];                     [weakself.navigationController pushViewController:webVC animated:YES];                 }                 else                 {                     [MBProgressHUD showText:@"没有对应的视频文件"];                 }                 [[NSNotificationCenter defaultCenter] postNotificationName:@"monitorNetworking" object:@"2" userInfo:nil];             }                 break;             default:                 break;         }         if (status == AFNetworkReachabilityStatusReachableViaWWAN || status == AFNetworkReachabilityStatusReachableViaWiFi) {             NSLog(@"有网");         }else{             NSLog(@"没网");         }     }];           } #pragma mark-------蜂窝网络下载提示 - (void)WWANNetworkingDownloadAler {     WS(weakSelf)     UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"当前非Wi-Fi环境,继续下载会使用您的数据流量" message:@"" preferredStyle:UIAlertControllerStyleAlert];     UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"流量下载" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {         LMSNDownloadMenuViewContorller *vc = [[LMSNDownloadMenuViewContorller alloc] initWithModel:weakSelf.detailModel courType:weakSelf.urlStr];         vc.catcheManageClouse = ^{             LMSNMyDownloadVC *vc = [LMSNMyDownloadVC new];             [weakSelf.navigationController pushViewController:vc animated:false];         };         LNavigationViewController *nav = [[LNavigationViewController alloc] initWithRootViewController:vc];         nav.modalPresentationStyle = UIModalPresentationFullScreen;         [weakSelf presentViewController:nav animated:false completion:nil];     }];     UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) {     }];     [cancelAction setValue:kUIColorFromRGBA(0x091522, 0.55) forKey:@"titleTextColor"];     [alert addAction:cancelAction];     [alert addAction:defaultAction];     [self presentViewController:alert animated:false completion:nil];      } - (void)inditatorLiuliangMethod:(NSNotification *)sender {     WS(weakSelf)     UIAlertController* alert = [UIAlertController alertControllerWithTitle:@"当前非Wi-Fi环境,继续播放会使用您的数据流量" message:@"" preferredStyle:UIAlertControllerStyleAlert];          UIAlertAction* defaultAction = [UIAlertAction actionWithTitle:@"流量播放" style:UIAlertActionStyleDefault handler:^(UIAlertAction * action) {         if (weakSelf.player.assetURL.absoluteString.length) {             //如果当前正在播放就啥也不干,如果当前没有播放的 就意味是第一次  正常播放就行         }         else         {             LMSNewLectureModel *learnModel = [LMSNewLectureModel mj_objectWithKeyValues:sender.object];             self.currentLearnModel = learnModel;             if (learnModel.mp4_url.length) {                 weakSelf.player.assetURL = [NSURL URLWithString:learnModel.mp4_url];                 weakSelf.player.pauseWhenAppResignActive = YES;                 if ([weakSelf.urlStr containsString:@"company-course"]) {//自制课程                     if (learnModel.progress.intValue>95) {                     }                     else                     {                         NSInteger lastSexond = [learnModel.last_learn integerValue];                         [weakSelf.playerManager seekToTime:lastSexond completionHandler:nil];                     }                 } else {//先之课程                     if ((learnModel.lecture_length.intValue - learnModel.last_learn.intValue)>10) {                         NSInteger lastSexond = [learnModel.last_learn integerValue];                         [weakSelf.playerManager seekToTime:lastSexond completionHandler:nil];                     }                 }                 weakSelf.listeningV416View.hidden = YES;                 [weakSelf removeTimerFromSelf];                 [weakSelf addTimerInSelf];                 weakSelf.viewTime = 0;//初始化本次播放时间                              }             else    if (learnModel.mp3_url.length) {                 self.listeningV416View.frame = CGRectMake(0, 0, kUIScreenWidth, kUIFitSize(192));                 self.player.assetURL = [NSURL URLWithString:learnModel.mp3_url];                 NSTimeInterval currentTime =  self.playerManager.currentTime;                 [weakSelf.playerManager seekToTime:currentTime completionHandler:^(BOOL finished) {                 }];                 weakSelf.listeningV416View.hidden = false;                 [weakSelf.listeningV416View bringSubviewToFront:weakSelf.listeningV416bgImageV];                 weakSelf.controlView.portraitControlView.currentTimeLabel.frame = CGRectMake(0, kUIFitSize(192)-40, 100, 24);                 weakSelf.controlView.portraitControlView.totalTimeLabel.frame = CGRectMake(kUIScreenWidth-100, kUIFitSize(192)-40, 70, 24);                 weakSelf.controlView.portraitControlView.slider.frame = CGRectMake(90,  kUIFitSize(192)-40, kUIScreenWidth-180, 24);;                 [weakSelf.listeningV416View addSubview:weakSelf.controlView.portraitControlView.currentTimeLabel];                 [weakSelf.listeningV416View addSubview:weakSelf.controlView.portraitControlView.totalTimeLabel];                 [weakSelf.listeningV416View addSubview:weakSelf.controlView.portraitControlView.slider];                 [weakSelf.listeningV416View bringSubviewToFront:weakSelf.controlView.portraitControlView.slider];                 [weakSelf.listeningV416View bringSubviewToFront:weakSelf.controlView.portraitControlView.currentTimeLabel];                 [weakSelf.listeningV416View bringSubviewToFront:weakSelf.controlView.portraitControlView.totalTimeLabel];                 weakSelf.player.pauseWhenAppResignActive = false;                 weakSelf.isPlay = @"1";

                [weakSelf removeTimerFromSelf];                 [weakSelf addTimerInSelf];                 weakSelf.viewTime = 0;//初始化本次播放时间             }             else   if (learnModel.document_id.length) {                 weakSelf.isPresent = @"1";                 [weakSelf pauseTimer];                 [weakSelf.player.currentPlayerManager pause];                 LMSNewBaiduReaderVC *baiduVC = [[LMSNewBaiduReaderVC alloc]init];                 baiduVC.lectureModel = learnModel;                 baiduVC.detailModel = weakSelf.detailModel;                 [weakSelf.navigationController pushViewController:baiduVC animated:YES];             }             else   if (learnModel.link.length) {                 weakSelf.isPresent = @"1";                 [weakSelf pauseTimer];                 [weakSelf.player.currentPlayerManager pause];                 LMSNewWebVC *webVC = [[LMSNewWebVC alloc] init];                  webVC.urlStr = learnModel.link;                  webVC.titleStr = @"课程详情";                  [weakSelf acqucireRecordServiceProgress:100 curpage:0];                 [weakSelf.navigationController pushViewController:webVC animated:YES];             }             else             {                 [MBProgressHUD showText:@"没有对应的视频文件"];             }         }     }];     UIAlertAction* cancelAction = [UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:^(UIAlertAction * action) {         [weakSelf pauseTimer];         [weakSelf.player.currentPlayerManager pause];     }];     [cancelAction setValue:kUIColorFromRGBA(0x091522, 0.55) forKey:@"titleTextColor"];     [alert addAction:cancelAction];     [alert addAction:defaultAction];          [weakSelf presentViewController:alert animated:YES completion:^{              }];      } #pragma mark  移除通知 - (void)dealloc {     [[NSNotificationCenter defaultCenter] removeObserver:self];     [_timer invalidate];     NSLog(@"VC销毁了"); }

- (void)resolutionBtnClick {     self.resolutionSuperView.hidden = NO; } //章节 - (void)courseBtnClick {     self.courseSuperView.hidden = NO;     [self.listTableView reloadData];          [self.listTableView reloadData]; } //倍速Action - (void)rateBtnClick {     self.rateSuperView.hidden = false; } -(UITableView *)listTableView{     if (!_listTableView) {         self.listTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, kUIFitSize(381), kUIScreenWidth) style:UITableViewStylePlain];         _listTableView.backgroundColor = [UIColor blackColor];         _listTableView.separatorStyle = UITableViewCellSeparatorStyleNone;              }     return _listTableView; }

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {     if (self.detailModel.study_configModel.can_learn_lecture.intValue!= 0) {         self.courseSuperView.hidden = YES;         LMSNewLectureChapterModel  *chapterModel = self.detailModel.chapterMArr[indexPath.section];         LMSNewLectureModel *lectureModel = chapterModel.lectureMArr[indexPath.row];         lectureModel.isLearning = YES;         self.currentLearnModel = lectureModel;         NSDictionary *dic = [self onereturnToDictionaryWithModel:lectureModel];         [[NSNotificationCenter defaultCenter] postNotificationName:KChangeNextPlay object:dic];         self.player.assetURL = [NSURL URLWithString:lectureModel.mp4_url];          if ([self.urlStr containsString:@"company-course"]) {//自制课程              if (self.currentLearnModel.progress.intValue>95) {              }              else              {                  NSInteger lastSexond = [self.currentLearnModel.last_learn integerValue];                  [self.playerManager seekToTime:lastSexond completionHandler:nil];              }          } else {//先之课程              if ((self.currentLearnModel.lecture_length.intValue - self.currentLearnModel.last_learn.intValue)>10) {                  NSInteger lastSexond = [self.currentLearnModel.last_learn integerValue];                  [self.playerManager seekToTime:lastSexond completionHandler:nil];              }                        }     }     else     {         if (self.detailModel.study_configModel.time_status.intValue == 3) {             [MBProgressHUD showText:@"课程已过期,无法继续学习"];         }         else         {             [MBProgressHUD showText:@"当前视频还不可以学习哦"];         }     }      } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {     NSArray *nibs = [[NSBundle mainBundle] loadNibNamed:@"LMSNewLearnBaseListTableViewCell" owner:self options:nil];     LMSNewLearnBaseListTableViewCell *cell = [nibs firstObject];     LMSNewLectureChapterModel  *chapterModel = self.detailModel.chapterMArr[indexPath.section];     LMSNewLectureModel *lectureModel = chapterModel.lectureMArr[indexPath.row];     cell.titleLabel.text = lectureModel.lecture_title;     if ([lectureModel.lecture_id isEqualToString:self.currentLearnModel.lecture_id]) {         cell.titleLabel.textColor = kUIColorFromRGB(0x0085FE);              }     else     {         cell.titleLabel.textColor = kUIColorFromRGB(0xffffff);              }          return cell;      } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {     return self.detailModel.chapterMArr.count; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {     LMSNewLectureChapterModel  *chapterModel = self.detailModel.chapterMArr[section];     if (chapterModel.shouldFolder) {         return 0;     }     else     {         return chapterModel.lectureMArr.count;     } } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {     return 140; }

 

//cell button点击事件 - (void)listcellBtnClick:(UIButton *)sender {          //  self.currentModel.isLearing = NO;     self.courseSuperView.hidden = YES;          CGPoint point = sender.center;     point = [self.listTableView convertPoint:point fromView:sender.superview];     NSIndexPath* indexPath = [self.listTableView indexPathForRowAtPoint:point];          LMSNewLectureChapterModel  *chapterModel = self.detailModel.chapterMArr[indexPath.section];     LMSNewLectureModel*lectureModel = chapterModel.lectureMArr[indexPath.row];     lectureModel.isLearning = YES;     self.player.assetURL = [NSURL URLWithString:lectureModel.mp4_url];     NSInteger dragedSeconds = [lectureModel.last_learn integerValue];     self.playerManager.seekTime =dragedSeconds;     self.player.assetURL = [NSURL URLWithString:lectureModel.mp4_url.length?lectureModel.mp4_url:lectureModel.mp4_url];     //    self.player.assetURL =[NSURL URLWithString:@"http://api.9first.com/test.mp3"];//音频测试     [self.controlView showTitle:lectureModel.lecture_title coverURLString:@"https://upload-images.jianshu.io/upload_images/635942-14593722fe3f0695.png?imageMogr2/auto-orient/strip%7CimageView2/2/w/1240" fullScreenMode:SZFullScreenModeLandscape];          self.currentLearnModel = lectureModel;     [self.listTableView reloadData];     if (lectureModel.mp4_url.length >0  ) {         self.resolutionSuperView.hidden = false;     }     else     {         self.resolutionSuperView.hidden = YES;     }     //    [self changeModel];          MyLog(@"132"); } - (UIView *)rateSuperView {     if (!_rateSuperView) {         _rateSuperView = [[UIView alloc]initWithFrame:CGRectMake(kUIScreenHeight-kUIFitSize(315), 0, kUIFitSize(315), kUIScreenWidth)];         _rateSuperView.hidden = YES;         _rateSuperView.backgroundColor = kUIColorFromRGBA(0x000000, 0.7);         NSArray * rateTitleArray = @[@"1.0X", @"1.25X", @"1.5X", @"2.0X"];         // 倍速父视图上边的Btn         for (NSInteger i = 0 ; i < rateTitleArray.count; i++) {             UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];             [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];             btn.layer.borderColor = [UIColor clearColor].CGColor;             btn.layer.borderWidth = 1;             btn.layer.cornerRadius = kUIFitSize(5);             btn.layer.masksToBounds = YES;             btn.tag = 3000+i;             btn.frame = CGRectMake(kUIFitSize(96), kUIFitSize(80)+ kUIFitSize(35+25)*i, kUIFitSize(123), kUIFitSize(35));             btn.titleLabel.font = [UIFont systemFontOfSize:kUIFitSize(20)];             [btn setTitle:rateTitleArray[i] forState:UIControlStateNormal];             if ([rateTitleArray[i] isEqualToString:self.rateLanscapeBtn.titleLabel.text]) {//设置当前选中按钮                 self.rateLanscapeCurrentBtn = btn;                 btn.selected = YES;                 btn.layer.borderColor = kUIColorFromRGB(0x0A93FF).CGColor;                 [btn setTitleColor:kUIColorFromRGB(0x0A93FF) forState:UIControlStateNormal];             }             [self.rateSuperView addSubview:btn];             [btn addTarget:self                     action:@selector(changeRate:)           forControlEvents:UIControlEventTouchUpInside];         }     }     return _rateSuperView; } - (UIView *)resolutionSuperView {     if (!_resolutionSuperView) {         _resolutionSuperView = [[UIView alloc]initWithFrame:CGRectMake(kUIScreenHeight-kUIFitSize(315), 0, kUIFitSize(315), kUIScreenWidth)];         _resolutionSuperView.hidden = YES;         _resolutionSuperView.backgroundColor = kUIColorFromRGBA(0x000000, 0.7);         NSArray * resolutionTitleArray = @[ @"流畅",@"高清"];         // 倍速父视图上边的Btn         for (NSInteger i = 0 ; i < resolutionTitleArray.count; i++) {             UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];             [btn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];             btn.layer.borderColor = [UIColor clearColor].CGColor;             btn.layer.borderWidth = 1;             btn.layer.cornerRadius = kUIFitSize(5);             btn.layer.masksToBounds = YES;             btn.tag = 2000+i;             btn.frame = CGRectMake(kUIFitSize(96), kUIFitSize(118)+ kUIFitSize(35+25)*i, kUIFitSize(123), kUIFitSize(35));             btn.titleLabel.font = [UIFont systemFontOfSize:kUIFitSize(20)];             [btn setTitle:resolutionTitleArray[i] forState:UIControlStateNormal];             if ([resolutionTitleArray[i] isEqualToString:self.resolutionLandscapeBtn.titleLabel.text]) {//设置当前选中按钮                 self.resolutionLandscapeCurrentBtn = btn;                 btn.selected = YES;                 btn.layer.borderColor = kUIColorFromRGB(0x0A93FF).CGColor;                 [btn setTitleColor:kUIColorFromRGB(0x0A93FF) forState:UIControlStateNormal];             }             [self.resolutionSuperView addSubview:btn];             [btn addTarget:self                     action:@selector(changeResolution:)           forControlEvents:UIControlEventTouchUpInside];         }     }     return _resolutionSuperView; } //点击倍速 - (void)changeRate:(UIButton *)sender {     self.rateLanscapeCurrentBtn.layer.borderColor = [UIColor clearColor].CGColor;     [self.rateLanscapeCurrentBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];          sender.layer.borderColor = kUIColorFromRGB(0x0A93FF).CGColor;     [sender setTitleColor:kUIColorFromRGB(0x0A93FF) forState:UIControlStateNormal];          self.rateLanscapeCurrentBtn = sender;     // 隐藏倍速列表父视图     self.rateSuperView.hidden  = YES;          // topImageView上的按钮的文字     [self.rateLanscapeBtn setTitle:sender.titleLabel.text                           forState:UIControlStateNormal]; //    [self.controlView.landScapeControlView.rateBtn setTitle:sender.titleLabel.text forState:UIControlStateNormal];     NSInteger indexForRate = sender.tag - 3000;     switch (indexForRate) {         case 0:             self.playerManager.rate = 1.0;             break;         case 1:             self.playerManager.rate = 1.25;             break;         case 2:             self.playerManager.rate = 1.5;             break;         case 3:             self.playerManager.rate = 2.0;             break;                      default:             break;     } } // 点击切换分辨率 - (void)changeResolution:(UIButton *)sender {          self.resolutionLandscapeCurrentBtn.layer.borderColor = [UIColor clearColor].CGColor;     [self.resolutionLandscapeCurrentBtn  setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];          sender.layer.borderColor = kUIColorFromRGB(0x0A93FF).CGColor;     [sender setTitleColor:kUIColorFromRGB(0x0A93FF) forState:UIControlStateNormal];          self.resolutionLandscapeCurrentBtn = sender;     // 隐藏倍速列表父视图     self.resolutionSuperView.hidden = YES;     // topImageView上的按钮的文字     [self.resolutionLandscapeBtn setTitle:sender.titleLabel.text                                  forState:UIControlStateNormal];     NSTimeInterval currentTime =  self.playerManager.currentTime;          if ([sender.currentTitle isEqualToString:@"流畅"]) {         //        self.player.assetURL = [NSURL URLWithString:_currentModel.mp4_url];     }else{         //        self.player.assetURL = [NSURL URLWithString:_currentModel.hd_mp4_url];     }     [self.playerManager seekToTime:currentTime completionHandler:^(BOOL finished) {     }]; } #pragma mark  音频 #pragma mark - 用户设置关闭定时器 //开启倒计时 - (void)startResidualTimer {     WS(weakself)     dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);     self.setTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0,queue);     dispatch_source_set_timer(_setTimer,dispatch_walltime(NULL, 0),1.0*NSEC_PER_SEC, 0); //每秒执行     dispatch_source_set_event_handler(_setTimer, ^{         if(weakself.timeout <= 0){ //倒计时结束,关闭             dispatch_source_cancel(weakself.setTimer);             dispatch_async(dispatch_get_main_queue(), ^{                 //停止播放                 [weakself.player.currentPlayerManager pause];                 [weakself.startAudioBtn setImage:[UIImage imageNamed:@"ic_bf_yp"] forState:UIControlStateNormal];                 weakself.isPlay = @"0";                 dispatch_async(dispatch_get_main_queue(), ^(){                     [weakself.daojishiBtn setTitle:@"" forState:UIControlStateNormal];                     [weakself.daojishiBtn setImage:[UIImage imageNamed:@"ic_ds"] forState:UIControlStateNormal];                     weakself.stopPlayout = NO;                 });                                                                });         }else{             dispatch_async(dispatch_get_main_queue(), ^(){                 switch (weakself.isPlay.intValue) {                     case 0:                     {                                              }                         break;                                              default:                     {                         weakself.timeout -- ;                         [weakself.daojishiBtn setTitle:[weakself getMMSSFromSS:weakself.timeout] forState:UIControlStateNormal];                         [weakself.daojishiBtn setImage:nil forState:UIControlStateNormal];                     }                         break;                 }             });                    }     });     dispatch_resume(_setTimer); }

     -(NSString *)getMMSSFromSS:(NSInteger )totalTime{                                                    //    NSInteger seconds = [totalTime integerValue];                                                        //format of hour                        //    NSString *str_hour = [NSString stringWithFormat:@"%02ld",seconds/3600];                            //format of minute        NSString *str_minute = [NSString stringWithFormat:@"%02ld",(totalTime%3600)/60];                            //format of second        NSString *str_second = [NSString stringWithFormat:@"%02ld",totalTime%60];                            //format of time                        //    NSString *format_time = [NSString stringWithFormat:@"%@:%@:%@",str_hour,str_minute,str_second];                                                         NSString *format_time = [NSString stringWithFormat:@"%@:%@",str_minute,str_second];                            return format_time;                                                    } #pragma mark  音频视图  V416之前有 现在被删掉了

#pragma mark  章节父视图 - (UIView *)courseSuperView {     if (!_courseSuperView) {         self.courseSuperView = [[UIView alloc]initWithFrame:CGRectMake(kUIScreenHeight-kUIFitSize(381), 0, kUIFitSize(381), kUIScreenWidth)];         _courseSuperView.hidden = YES;         _courseSuperView.backgroundColor = [UIColor blackColor];     }     return _courseSuperView; } - (NSMutableArray *)allListAry {     if (!_allListAry) {         self.allListAry = [NSMutableArray array];     }     return _allListAry; }

#pragma mark 模型转字典 -(NSMutableDictionary *)onereturnToDictionaryWithModel:(LMSNewLectureModel *)model

{          NSMutableDictionary *userDic = [NSMutableDictionary dictionary];          unsigned int count = 0;          objc_property_t *properties = class_copyPropertyList([LMSNewLectureModel class], &count);          for (int i = 0; i < count; i++) {                  const char *name = property_getName(properties[i]);                  NSString *propertyName = [NSString stringWithUTF8String:name];                  id propertyValue = [model valueForKey:propertyName];                  if (propertyValue) {                          [userDic setObject:propertyValue forKey:propertyName];                      }              }          free(properties);          return userDic;      } - (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldReceiveTouch:(UITouch *)touch  {          //点击的view的类名     NSLog(@"%@", NSStringFromClass([touch.view class]));          // UITableViewCellContentView就是点击了tableViewCell,则不截获点击事件     if ([NSStringFromClass([touch.view class]) isEqualToString:@"UITableViewCellContentView"]){                  return NO;     }          return  YES; } - (void)acqucireRecordServiceProgress:(NSInteger)progress curpage:(NSInteger)last_learn {          NSDictionary *para = @{@"learn_id":self.currentLearnModel.lecture_id,                            @"progress":@(progress),                            @"last_learn":@(last_learn)                            };          [[LMSNewAPIClient apiManager] putRequestAPI:[NSString stringWithFormat:@"client/plan/learn/progress/%@",self.detailModel.relation_id] parameters:para success:^(NSURLSessionDataTask *dataTask, id JSON) {              } failure:^(NSURLSessionDataTask *dataTask, NSError *error) {              }]; } - (void)acqutireTimeRecordLast_learn:(NSInteger)last_learn {     NSDictionary *para = @{@"learn_id":self.currentLearnModel.lecture_id,                                                        @"last_learn":@(last_learn)                            };     [[LMSNewAPIClient apiManager] putRequestAPI:[NSString stringWithFormat:@"client/plan/learn/%@",self.detailModel.relation_id] parameters:para success:^(NSURLSessionDataTask *dataTask, id JSON) {              } failure:^(NSURLSessionDataTask *dataTask, NSError *error) {              }];      } #pragma mark 监管app前台还是后台 - (void)applicationEnterBackground {          [self pauseTimer]; } - (void)applicationBecomeActive {     [self beginTimer]; }

#pragma mark 仅仅是网络请求更新数据 - (void)acquireReloadNetWorking {     WS(weakself)     NSDictionary *parameters = @{@"token":kUserToken                                                                    };     //todo @"client/plan/course/21676"     [[LMSNewAPIClient apiManager] getRequestAPI:[NSString stringWithFormat:@"%@%@",self.urlStr,self.relationID] parameters:parameters success:^(NSURLSessionDataTask *dataTask, id JSON) {         MyLog(@"%@", JSON);         weakself.detailModel = [LMSNewLearnDetailModel mj_objectWithKeyValues:JSON[@"data"]];         [weakself showEvaluateAction];         if([weakself.detailModel.chapterMArr.firstObject isNotNullOrEmpty] == NO) {             //            return;         }         [[NSNotificationCenter defaultCenter] postNotificationName:KLearnBaseReloadNetWorking object:JSON[@"data"]];         //这个时候该给另外两个控制器更新数据源              } failure:^(NSURLSessionDataTask *dataTask, NSError *error) {              }]; } #pragma mark  弹出是否点击去评价的弹框 - (void) showEvaluateAction {     WS(weakself)          //      NSString *isfirst = [[NSUserDefaults standardUserDefaults] objectForKey:KFirstEvaluate];     NSData *data = [[NSUserDefaults standardUserDefaults]objectForKey:KCourseEvaluateIDKeys];     NSString *isfirst = nil;     NSTimeInterval interval = 0;     if (data) {         NSDictionary *jsonDict = (NSDictionary*) [NSKeyedUnarchiver unarchiveObjectWithData:data];         //            NSDictionary *jsonDict = [NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableLeaves error:nil];                  if ([[jsonDict allKeys]containsObject:self.detailModel.course_id]) {             isfirst = jsonDict[self.detailModel.course_id];         }         NSDateFormatter *fmt = [[NSDateFormatter alloc] init];         fmt.dateFormat = @"yyyy-MM-dd HH:mm:ss";         NSDate *createdAtDate = [fmt dateFromString:isfirst];                  // 手机当前时间         //    NSDate *nowDate = [NSDate date];                  // 获得createdAtDate和nowDate的时间间隔(间隔多少秒)         //    NSTimeInterval interval = [nowDate timeIntervalSinceDate:createdAtDate];         interval = [createdAtDate timeIntervalSinceNow];         NSLog(@"%f", interval);     }     //        if ([self.urlStr isEqualToString:@"client/plan/course/"]&&self.detailModel.progress.intValue>=60 && self.detailModel.study_configModel.re_test_num.intValue>=1&&( isfirst.length == 0||fabsf(interval)>=60*60*24*5)  && self.detailModel.feedbackModel.feedback_id.intValue == 0) {//线上环境     if ([self.urlStr isEqualToString:@"client/plan/course/"]&&self.detailModel.progress.intValue>=60 && self.detailModel.study_configModel.re_test_num.intValue>=1&&( isfirst.length == 0||fabs(interval)>=60*60*24*5)  && self.detailModel.feedbackModel.feedback_id.intValue == 0) {         weakself.lCerBuySucceedView = [[LCerBuySucceedView alloc]initWithFrame:CGRectMake(0, 0, kUIScreenWidth, kUIScreenHeight)];         weakself.lCerBuySucceedView.delegate = weakself;         weakself.lCerBuySucceedView.detailModel = weakself.detailModel;         [[[UIApplication sharedApplication].delegate window] addSubview:weakself.lCerBuySucceedView];                                         } } #pragma mark  //音频处理 #pragma marl ######################################################音频这里挑出来 #pragma mark - 用户设置关闭定时器

#pragma mark - 返回按钮点击 -(void)backBtnClick{     [[NSNotificationCenter defaultCenter] postNotificationName:@"learnbackAction" object:nil]; } //视频讲义按钮点击 - (void)tipsBtnClick:(UIButton *)sender {     switch (sender.tag-233) {         case 0:{             [self setTimeAction];                  }             break;         case 1:{ //            [MBProgressHUD showText:@"下载"];             WS(weakSelf)                 weakSelf.isPresent = @"1";                 [MobClick event:@"v4_ios_learn_download"]; #pragma mark----下载音频跳转                 if([[NSUserDefaults standardUserDefaults] boolForKey:kSettingIsUseDataWatchCourse] == NO && [AFNetworkReachabilityManager sharedManager].isReachableViaWWAN) {//蜂窝网络且不允许流量下载                     [weakSelf WWANNetworkingDownloadAler];                 } else {                     LMSNDownloadMenuViewContorller *vc = [[LMSNDownloadMenuViewContorller alloc] initWithModel:weakSelf.detailModel courType:weakSelf.urlStr];                     vc.catcheManageClouse = ^{                                                  LMSNMyDownloadVC *vc = [LMSNMyDownloadVC new];                         [weakSelf.navigationController pushViewController:vc animated:false];                     };                     LNavigationViewController *nav = [[LNavigationViewController alloc] initWithRootViewController:vc];                     nav.modalPresentationStyle = UIModalPresentationFullScreen;                     [weakSelf presentViewController:nav animated:false completion:nil];                 }                 }             break;         case 2:{             if (self.currentLearnModel.mp4_url.length) {                 [self videoBtnClick];             }             else             {                 [MBProgressHUD showText:@"当前课程没有视频哦"];             }         }             break;                      default:             break;     } } - (void)videoBtnClick {     self.player.assetURL = [NSURL URLWithString:self.currentLearnModel.mp4_url];     self.audioTitleLabel.text = self.currentLearnModel.lecture_title;     self.listeningV416View.hidden = YES;     [self.controlView.portraitControlView.slider removeFromSuperview];     [self.controlView.portraitControlView.currentTimeLabel removeFromSuperview];     [self.controlView.portraitControlView.totalTimeLabel removeFromSuperview];     self.controlView.portraitControlView.slider.frame = CGRectMake(90, 10, kUIScreenWidth-180, 24);     self.controlView.portraitControlView.currentTimeLabel.frame = CGRectMake(0, 10, 100, 24);     self.controlView.portraitControlView.totalTimeLabel.frame = CGRectMake(kUIScreenWidth-100, 10, 70, 24);     [self.controlView.portraitControlView.bottomToolView addSubview:self.controlView.portraitControlView.slider];     [self.controlView.portraitControlView.bottomToolView addSubview:self.controlView.portraitControlView.currentTimeLabel];     [self.controlView.portraitControlView.bottomToolView addSubview:self.controlView.portraitControlView.totalTimeLabel];

     self.player.pauseWhenAppResignActive = YES;     if ([self.urlStr containsString:@"company-course"]) {//自制课程          if (self.currentLearnModel.progress.intValue>95) {          }          else          {              NSInteger lastSexond = [self.currentLearnModel.last_learn integerValue];              [self.playerManager seekToTime:lastSexond completionHandler:nil];          }      } else {//先之课程          if ((self.currentLearnModel.lecture_length.intValue - self.currentLearnModel.last_learn.intValue)>10) {              NSInteger lastSexond = [self.currentLearnModel.last_learn integerValue];              [self.playerManager seekToTime:lastSexond completionHandler:nil];          }      } } #pragma mark - 控制按钮点击 //快退 -(void)retreatBtnClick{     NSInteger time = (self.player.currentTime - 15) >= 0 ? (self.player.currentTime - 15) : 0;     [self.playerManager seekToTime:time completionHandler:nil];     WS(weakself)     if (self.stopPlayout) {         NSTimeInterval currentTimeSec = weakself.player.currentTime;         //获取已经播放的时间         NSTimeInterval totalTimeSec = weakself.player.totalTime;                  weakself.timeout  =floor(totalTimeSec - currentTimeSec+0.5)+1;         [weakself startResidualTimer];     } }

//开始、暂停 -(void)startBtnClick:(UIButton *)sender{     

       if ([self.isPlay isEqualToString:@"1"]) {          [self.startAudioBtn setImage:[UIImage imageNamed:@"ic_bf_yp"] forState:UIControlStateNormal];          self.isPlay = @"0";          [self pauseTimer];          [self.player.currentPlayerManager pause];               }else{           [self.startAudioBtn  setImage:[UIImage imageNamed:@"ic_yp_bf"] forState:UIControlStateNormal];            self.isPlay = @"1";           [self beginTimer];           [self.player.currentPlayerManager play];                      } // }

 

//快进 -(void)forwardBtnClick{     NSInteger time = (self.player.currentTime + 15) <= self.player.totalTime ? (self.player.currentTime + 15) : self.player.totalTime;     [self.playerManager seekToTime:time completionHandler:nil];     WS(weakself)     if (self.stopPlayout) {         NSTimeInterval currentTimeSec = weakself.player.currentTime;         //获取已经播放的时间         NSTimeInterval totalTimeSec = weakself.player.totalTime;                  weakself.timeout  =( floor(totalTimeSec - currentTimeSec +0.5)-13);         [weakself startResidualTimer];     } }

#pragma mark 定时 - (void)setTimeAction {     PlayerTimingView *timingView = [[PlayerTimingView alloc] initWithFrame:[UIApplication sharedApplication].keyWindow.bounds];     WS(weakself)     timingView.selectedBlock = ^(NSInteger index) {         switch (index) {             case 0:{                 weakself.stopPlayout = NO;                 if (weakself.setTimer) {                     dispatch_source_cancel(weakself.setTimer);                 }                 [weakself.daojishiBtn setTitle:@"" forState:UIControlStateNormal];                 [weakself.daojishiBtn setImage:[UIImage imageNamed:@"ic_ds"] forState:UIControlStateNormal];             }                 break;             case 1:{ //15分钟                 weakself.stopPlayout = NO;                 weakself.timeout = 15 * 60;                 [weakself startResidualTimer];             }                 break;             case 2:{ //30分钟                 weakself.stopPlayout = NO;                 weakself.timeout = 30 * 60;                 [weakself startResidualTimer];             }                 break;             case 3:{ //45分钟                 weakself.stopPlayout = NO;                 weakself.timeout = 45 * 60;                 [weakself startResidualTimer];             }                 break;             case 4:{ //60分钟                 weakself.stopPlayout = NO;                 weakself.timeout = 60 * 60;                 [weakself startResidualTimer];             }                 break;             case 5:{ //播放完当前音频                 weakself.stopPlayout = YES;                 if (weakself.setTimer) {                     dispatch_source_cancel(weakself.setTimer);                 }                 NSTimeInterval currentTimeSec = weakself.player.currentTime;                 //获取已经播放的时间                 NSTimeInterval totalTimeSec = weakself.player.totalTime;                 weakself.timeout  = floor(totalTimeSec - currentTimeSec+0.5);                 [weakself startResidualTimer];             }                 break;         }     };          [timingView show]; }

 

控制器没有离开页面,问题解决了原因没找到

最新回复(0)