Skip to content

Commit 357a21b

Browse files
ccharlesrenSundoggyNew
authored andcommitted
【IoT Video终端集成测试】ios端回放,选择时间范围无视频,但是还是可以继续播放视频
Tapd: http://tapd.oa.com/20393192/bugtrace/bugs/view?bug_id=1020393192091173519&url_cache_key=acdba194b0e2e0da542714b9a0bf0507 Tapd: http://tapd.oa.com/NEW_IOT/bugtrace/bugs/view?bug_id=1020393192091173519&jump_count=1 Change-Id: I92c421bc5ccf8376fcbb6adaa25a0c97576508cd
1 parent cae5eb4 commit 357a21b

File tree

2 files changed

+68
-44
lines changed

2 files changed

+68
-44
lines changed

Source/LinkSDKDemo/Video/P2P/View/CustomTimeSlider/TIoTDemoCustomChoiceDateView.m

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,14 +312,24 @@ - (void)getTimeDataScorllEnd:(UIScrollView *)scrollView {
312312
NSString *startTimestampString = [NSString getTimeStampWithString:dateString withFormatter:@"YYYY-MM-dd HH:mm:ss" withTimezone:@""];
313313

314314
__weak typeof(self) weakSelf = self;
315+
__block NSInteger isEmptyData = 0;
316+
315317
[self.videoTimeSegmentArray enumerateObjectsUsingBlock:^(id _Nonnull obj, NSUInteger idx, BOOL * _Nonnull stop) {
316318
TIoTTimeModel *model = obj;
317319
if (tempStartTime >= model.startTime && tempStartTime <= model.endTime) {
318320
if (weakSelf.timeModelBlock) {
321+
isEmptyData = 1;
319322
weakSelf.timeModelBlock(model, startTimestampString.floatValue);
320323
}
321324
}
322325
}];
326+
327+
//判断滚动空数据处,返回空数据标识
328+
if (isEmptyData == 0) {
329+
if (weakSelf.timeModelBlock) {
330+
weakSelf.timeModelBlock([TIoTTimeModel new], -1);
331+
}
332+
}
323333
}
324334

325335
/*

Source/LinkSDKDemo/Video/PlayBack/CloudStorage/Controller/TIoTCloudStorageVC.m

Lines changed: 58 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)