@@ -289,57 +289,71 @@ - (void)setupUIViews {
289289 // 滑动停止后,获取当前值所在事件开始/结束时间戳
290290 self.choiceDateView .timeModelBlock = ^(TIoTTimeModel * _Nonnull selectedTimeModel, CGFloat startTimestamp) {
291291 DDLogVerbose (@" startStamp--%f ----%f " ,startTimestamp,selectedTimeModel.startTime );
292-
293- // 关闭定时器
294- [weakSelf closeTime ];
295-
296- TIoTDemoCloudEventModel *currentModel = [[TIoTDemoCloudEventModel alloc ]init];
297-
298- NSString *startString = [NSString stringWithFormat: @" %@ 00:00:00" ,weakSelf.currentDayTime?:@" " ];
299- NSString *startTimestampString = [NSString getTimeStampWithString: startString withFormatter: @" YYYY-MM-dd HH:mm:ss" withTimezone: @" " ];
300-
301- NSInteger startValue = startTimestampString.integerValue + selectedTimeModel.startTime ;
302- NSInteger startDurationValue = startTimestamp - startValue;
303-
304- NSInteger endStamp = startTimestampString.integerValue + selectedTimeModel.endTime ;
305- currentModel.StartTime = [NSString stringWithFormat: @" %ld " ,(long )startValue];
306- currentModel.EndTime = [NSString stringWithFormat: @" %ld " ,(long )endStamp];
307- weakSelf.currentTime = startDurationValue;
308- weakSelf.slider .value = startDurationValue;
309- weakSelf.player .currentPlaybackTime = startDurationValue;
310- weakSelf.scrollDuraionTime = weakSelf.currentTime ;
311- weakSelf.startStamp = startValue;
312- weakSelf.isInnerScroll = YES ;
313- weakSelf.isHidePlayBtn = YES ;
314- weakSelf.isPause = NO ;
315-
316- if (weakSelf.videoTimeModel .StartTime .integerValue <= startTimestamp && weakSelf.videoTimeModel .EndTime .integerValue >=startTimestamp ) {
317- if (weakSelf.isTimerSuspend == YES ) {
318- if (weakSelf.timer ) {
292+ if (startTimestamp == -1 ) {
293+
294+ [MBProgressHUD showError: @" 暂无播放数据" ];
295+ // 滑动到空数据, 销毁player, 关闭定时器
296+ [weakSelf closeTime ];
297+ [weakSelf stopPlayMovie ];
298+
299+ }else {
300+ // 关闭定时器
301+ [weakSelf closeTime ];
302+
303+ TIoTDemoCloudEventModel *currentModel = [[TIoTDemoCloudEventModel alloc ]init];
304+
305+ NSString *startString = [NSString stringWithFormat: @" %@ 00:00:00" ,weakSelf.currentDayTime?:@" " ];
306+ NSString *startTimestampString = [NSString getTimeStampWithString: startString withFormatter: @" YYYY-MM-dd HH:mm:ss" withTimezone: @" " ];
307+
308+ NSInteger startValue = startTimestampString.integerValue + selectedTimeModel.startTime ;
309+ NSInteger startDurationValue = startTimestamp - startValue;
310+
311+ NSInteger endStamp = startTimestampString.integerValue + selectedTimeModel.endTime ;
312+ currentModel.StartTime = [NSString stringWithFormat: @" %ld " ,(long )startValue];
313+ currentModel.EndTime = [NSString stringWithFormat: @" %ld " ,(long )endStamp];
314+ weakSelf.currentTime = startDurationValue;
315+ weakSelf.slider .value = startDurationValue;
316+ weakSelf.player .currentPlaybackTime = startDurationValue;
317+ weakSelf.scrollDuraionTime = weakSelf.currentTime ;
318+ weakSelf.startStamp = startValue;
319+ weakSelf.isInnerScroll = YES ;
320+ weakSelf.isHidePlayBtn = YES ;
321+ weakSelf.isPause = NO ;
322+
323+ if (weakSelf.videoTimeModel .StartTime .integerValue <= startTimestamp && weakSelf.videoTimeModel .EndTime .integerValue >=startTimestamp ) {
324+
325+ if (weakSelf.player == nil ) { // 滑动到空数据,销毁player,重新请求
326+ [weakSelf getFullVideoURLWithPartURL: weakSelf.listModel.VideoURL withTime: currentModel isChangeModel: YES ];
327+ }else {
319328 if (weakSelf.isTimerSuspend == YES ) {
320- dispatch_resume (weakSelf.timer );
321- weakSelf.isTimerSuspend = NO ;
329+ if (weakSelf.timer ) {
330+ if (weakSelf.isTimerSuspend == YES ) {
331+ dispatch_resume (weakSelf.timer );
332+ weakSelf.isTimerSuspend = NO ;
333+ }
334+ }
335+
336+ // 关闭定时器
337+ if (weakSelf.timer != nil ) {
338+ dispatch_source_cancel (weakSelf.timer );
339+ weakSelf.timer = nil ;
340+ }
341+ }
342+ if (weakSelf.player .isPlaying == NO ) {
343+ [weakSelf tapVideoView: weakSelf.playPauseBtn];
322344 }
345+ [weakSelf startPlayVideoWithStartTime: currentModel.StartTime.integerValue endTime: currentModel.EndTime.integerValue sliderValue: weakSelf.currentTime];
323346 }
324347
325- // 关闭定时器
326- if (weakSelf.timer != nil ) {
327- dispatch_source_cancel (weakSelf.timer );
328- weakSelf.timer = nil ;
329- }
330- }
331- if (weakSelf.player .isPlaying == NO ) {
332- [weakSelf tapVideoView: weakSelf.playPauseBtn];
348+ }else {
349+ [weakSelf getFullVideoURLWithPartURL: weakSelf.listModel.VideoURL withTime: currentModel isChangeModel: YES ];
333350 }
334- [weakSelf startPlayVideoWithStartTime: currentModel.StartTime.integerValue endTime: currentModel.EndTime.integerValue sliderValue: weakSelf.currentTime];
335- }else {
336- [weakSelf getFullVideoURLWithPartURL: weakSelf.listModel.VideoURL withTime: currentModel isChangeModel: YES ];
351+
352+ TIoTDemoCloudEventModel *scorllCurrentModel = [[TIoTDemoCloudEventModel alloc ]init];
353+ scorllCurrentModel.StartTime = [NSString stringWithFormat: @" %f " ,startTimestamp];
354+ [weakSelf setScrollOffsetWith: scorllCurrentModel];
337355 }
338356
339- TIoTDemoCloudEventModel *scorllCurrentModel = [[TIoTDemoCloudEventModel alloc ]init];
340- scorllCurrentModel.StartTime = [NSString stringWithFormat: @" %f " ,startTimestamp];
341- [weakSelf setScrollOffsetWith: scorllCurrentModel];
342-
343357 };
344358 [self .view addSubview: self .choiceDateView];
345359
0 commit comments