Commit cf5de308 by 李威

进度条bug

parent d2a9569c
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
1CA57422038A0DCD4DC42056 /* Pods_HJMDrWarter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 82BD61577192800BFFDBFA48 /* Pods_HJMDrWarter.framework */; }; 1CA57422038A0DCD4DC42056 /* Pods_HJMDrWarter.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 82BD61577192800BFFDBFA48 /* Pods_HJMDrWarter.framework */; };
28CBDA67CE2B933E3BE49AD0 /* Pods_DJMPS2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE531B568DE2714EB3C17FBC /* Pods_DJMPS2.framework */; }; 28CBDA67CE2B933E3BE49AD0 /* Pods_DJMPS2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BE531B568DE2714EB3C17FBC /* Pods_DJMPS2.framework */; };
29B4811846DA9AFF6B864DFF /* Pods_DJMHomeTY.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C7A66C6D755F78ABD051F3B /* Pods_DJMHomeTY.framework */; }; 29B4811846DA9AFF6B864DFF /* Pods_DJMHomeTY.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1C7A66C6D755F78ABD051F3B /* Pods_DJMHomeTY.framework */; };
390516C72BAA75D000935EDE /* DXHotElecticView.m in Sources */ = {isa = PBXBuildFile; fileRef = 390516C62BAA75D000935EDE /* DXHotElecticView.m */; };
39E50A9E2BA81F8900D48C7D /* DXHotElectricVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 39E50A9D2BA81F8900D48C7D /* DXHotElectricVC.m */; }; 39E50A9E2BA81F8900D48C7D /* DXHotElectricVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 39E50A9D2BA81F8900D48C7D /* DXHotElectricVC.m */; };
39E50A9F2BA81F8900D48C7D /* DXHotElectricVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 39E50A9D2BA81F8900D48C7D /* DXHotElectricVC.m */; }; 39E50A9F2BA81F8900D48C7D /* DXHotElectricVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 39E50A9D2BA81F8900D48C7D /* DXHotElectricVC.m */; };
39E50AA02BA81F8900D48C7D /* DXHotElectricVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 39E50A9D2BA81F8900D48C7D /* DXHotElectricVC.m */; }; 39E50AA02BA81F8900D48C7D /* DXHotElectricVC.m in Sources */ = {isa = PBXBuildFile; fileRef = 39E50A9D2BA81F8900D48C7D /* DXHotElectricVC.m */; };
...@@ -650,6 +651,8 @@ ...@@ -650,6 +651,8 @@
1C7A66C6D755F78ABD051F3B /* Pods_DJMHomeTY.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DJMHomeTY.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 1C7A66C6D755F78ABD051F3B /* Pods_DJMHomeTY.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_DJMHomeTY.framework; sourceTree = BUILT_PRODUCTS_DIR; };
22A9E98F925FC76E4FDE64EC /* Pods-DJMHomeDR.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DJMHomeDR.release.xcconfig"; path = "Target Support Files/Pods-DJMHomeDR/Pods-DJMHomeDR.release.xcconfig"; sourceTree = "<group>"; }; 22A9E98F925FC76E4FDE64EC /* Pods-DJMHomeDR.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DJMHomeDR.release.xcconfig"; path = "Target Support Files/Pods-DJMHomeDR/Pods-DJMHomeDR.release.xcconfig"; sourceTree = "<group>"; };
2DDF3A57856A2F27B92CD379 /* Pods-HJMDrWarter.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HJMDrWarter.debug.xcconfig"; path = "Target Support Files/Pods-HJMDrWarter/Pods-HJMDrWarter.debug.xcconfig"; sourceTree = "<group>"; }; 2DDF3A57856A2F27B92CD379 /* Pods-HJMDrWarter.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-HJMDrWarter.debug.xcconfig"; path = "Target Support Files/Pods-HJMDrWarter/Pods-HJMDrWarter.debug.xcconfig"; sourceTree = "<group>"; };
390516C52BAA75D000935EDE /* DXHotElecticView.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DXHotElecticView.h; sourceTree = "<group>"; };
390516C62BAA75D000935EDE /* DXHotElecticView.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DXHotElecticView.m; sourceTree = "<group>"; };
39E1E5FF031957A0EABCCB00 /* Pods-DJMHomeTY.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DJMHomeTY.debug.xcconfig"; path = "Target Support Files/Pods-DJMHomeTY/Pods-DJMHomeTY.debug.xcconfig"; sourceTree = "<group>"; }; 39E1E5FF031957A0EABCCB00 /* Pods-DJMHomeTY.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-DJMHomeTY.debug.xcconfig"; path = "Target Support Files/Pods-DJMHomeTY/Pods-DJMHomeTY.debug.xcconfig"; sourceTree = "<group>"; };
39E50A9C2BA81F8900D48C7D /* DXHotElectricVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DXHotElectricVC.h; sourceTree = "<group>"; }; 39E50A9C2BA81F8900D48C7D /* DXHotElectricVC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = DXHotElectricVC.h; sourceTree = "<group>"; };
39E50A9D2BA81F8900D48C7D /* DXHotElectricVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DXHotElectricVC.m; sourceTree = "<group>"; }; 39E50A9D2BA81F8900D48C7D /* DXHotElectricVC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = DXHotElectricVC.m; sourceTree = "<group>"; };
...@@ -1133,6 +1136,8 @@ ...@@ -1133,6 +1136,8 @@
6CB327DD2AEFA1A600ABAEC3 /* DXHFXView.m */, 6CB327DD2AEFA1A600ABAEC3 /* DXHFXView.m */,
6CAFE73D2AFB8E6500C929A7 /* DXHFXVideoCell.h */, 6CAFE73D2AFB8E6500C929A7 /* DXHFXVideoCell.h */,
6CAFE73E2AFB8E6500C929A7 /* DXHFXVideoCell.m */, 6CAFE73E2AFB8E6500C929A7 /* DXHFXVideoCell.m */,
390516C52BAA75D000935EDE /* DXHotElecticView.h */,
390516C62BAA75D000935EDE /* DXHotElecticView.m */,
39E50AA22BA8272800D48C7D /* DXProgressBarView.h */, 39E50AA22BA8272800D48C7D /* DXProgressBarView.h */,
39E50AA32BA8272800D48C7D /* DXProgressBarView.m */, 39E50AA32BA8272800D48C7D /* DXProgressBarView.m */,
); );
...@@ -2956,6 +2961,7 @@ ...@@ -2956,6 +2961,7 @@
884E45FD29A600B600A58A9A /* UITextView+XHSelect.m in Sources */, 884E45FD29A600B600A58A9A /* UITextView+XHSelect.m in Sources */,
88F07F1A29C1C4BF00B2EBE6 /* XHAgreementView.m in Sources */, 88F07F1A29C1C4BF00B2EBE6 /* XHAgreementView.m in Sources */,
88C3CA8329CEC273004301FC /* XHSetOrPersonalView.m in Sources */, 88C3CA8329CEC273004301FC /* XHSetOrPersonalView.m in Sources */,
390516C72BAA75D000935EDE /* DXHotElecticView.m in Sources */,
884E463A29A600B600A58A9A /* XHDataManager.m in Sources */, 884E463A29A600B600A58A9A /* XHDataManager.m in Sources */,
884E460329A600B600A58A9A /* ZXSegmentHeaderModel.m in Sources */, 884E460329A600B600A58A9A /* ZXSegmentHeaderModel.m in Sources */,
884E460E29A600B600A58A9A /* XHMD5.m in Sources */, 884E460E29A600B600A58A9A /* XHMD5.m in Sources */,
......
...@@ -7,11 +7,10 @@ ...@@ -7,11 +7,10 @@
#import "DXHotElectricVC.h" #import "DXHotElectricVC.h"
#import "DXProgressBarView.h" #import "DXProgressBarView.h"
@interface DXHotElectricVC ()<DXProgressBarViewDelegate>{ @interface DXHotElectricVC (){
CGFloat palyTime; CGFloat palyTime;
} }
@property (nonatomic ,strong)NSTimer *timer;
@property (nonatomic ,strong)DXProgressBarView *progressBarView;
@end @end
...@@ -19,38 +18,23 @@ ...@@ -19,38 +18,23 @@
- (void)viewDidLoad { - (void)viewDidLoad {
[super viewDidLoad]; [super viewDidLoad];
self.title = HJLocalizedString(@"DR-05");
self.progressBarView = [[DXProgressBarView alloc] initWithFrame:CGRectMake(0, 200, HJScreenWidth, 30)]; [self initUI];
self.progressBarView.delegate = self;
[self.view addSubview:self.progressBarView];
NSArray *array = @[@60,@20,@100,@50,@70,@60];
[self.progressBarView progressBarTimeArray:array Totaltime:360];
if (self.timer == nil) {
self.timer=[NSTimer scheduledTimerWithTimeInterval:1.0f target:self selector:@selector(handletimerAction) userInfo:nil repeats:true];
[[NSRunLoop mainRunLoop] addTimer:self.timer forMode:NSDefaultRunLoopMode];
}
// Do any additional setup after loading the view. // Do any additional setup after loading the view.
} }
-(void)playVideoTime:(CGFloat)time { -(void)initUI {
palyTime = time;
} }
-(void)handletimerAction { -(void)handletimerAction {
palyTime++;
if (palyTime>=360) {
[self.timer invalidate];
self.timer = nil;
}
self.progressBarView.playTime = palyTime;
} }
-(void)viewDidDisappear:(BOOL)animated { -(void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated]; [super viewDidDisappear:animated];
[self.timer invalidate];
self.timer = nil;
} }
......
...@@ -618,7 +618,16 @@ static NSString *dXHFXVideoCell = @"DXHFXVideoCell"; ...@@ -618,7 +618,16 @@ static NSString *dXHFXVideoCell = @"DXHFXVideoCell";
} }
[titleTimeArray1 addObject:titleTime]; [titleTimeArray1 addObject:titleTime];
} }
NSInteger vvv = self.playerView.totalTime; self.progressBarView.timeArray = nil;
HJSelfWeak;
self.playerView.playerPlayTimeChanged = ^(id<ZFPlayerMediaPlayback> _Nonnull asset, NSTimeInterval currentTime, NSTimeInterval duration) {
if (!weakSelf.progressBarView.timeArray) {
[weakSelf.progressBarView progressBarTimeArray:timeArray Totaltime:duration];
NSLog(@"当前播放时间=%f",currentTime);
}
weakSelf.progressBarView.playTime = currentTime;
};
return timeArray; return timeArray;
// //
...@@ -772,16 +781,16 @@ static NSString *dXHFXVideoCell = @"DXHFXVideoCell"; ...@@ -772,16 +781,16 @@ static NSString *dXHFXVideoCell = @"DXHFXVideoCell";
_allfaceBtn.hidden = YES; _allfaceBtn.hidden = YES;
[_allfaceBtn setTitle:_currentVideoList[0].detail forState:UIControlStateNormal]; [_allfaceBtn setTitle:_currentVideoList[0].detail forState:UIControlStateNormal];
} }
NSMutableArray *timeArray = [self setTimeLineWithString:_currentVideoList[0].describeInfo]; [self setTimeLineWithString:_currentVideoList[0].describeInfo];
self.playerView.playerPlayTimeChanged = ^(id<ZFPlayerMediaPlayback> _Nonnull asset, NSTimeInterval currentTime, NSTimeInterval duration) { // self.playerView.playerPlayTimeChanged = ^(id<ZFPlayerMediaPlayback> _Nonnull asset, NSTimeInterval currentTime, NSTimeInterval duration) {
if (!weakSelf.progressBarView.timeArray) { // if (!weakSelf.progressBarView.timeArray) {
[weakSelf.progressBarView progressBarTimeArray:timeArray Totaltime:duration]; // [weakSelf.progressBarView progressBarTimeArray:timeArray Totaltime:duration];
NSLog(@"当前播放时间=%f",currentTime); // NSLog(@"当前播放时间=%f",currentTime);
} // }
//
weakSelf.progressBarView.playTime = currentTime; // weakSelf.progressBarView.playTime = currentTime;
}; // };
[_collectionView reloadData]; [_collectionView reloadData];
} }
......
//
// DXHotElecticView.h
// DJMHomeTY
//
// Created by nana on 2024/3/20.
//
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface DXHotElecticView : UIView
@end
NS_ASSUME_NONNULL_END
//
// DXHotElecticView.m
// DJMHomeTY
//
// Created by nana on 2024/3/20.
//
#import "DXHotElecticView.h"
@implementation DXHotElecticView
-(instancetype)init {
self = [super init];
if(self) {
self.backgroundColor = XHColorRGB_Alpha(247, 247, 247, 1);
}
return self;
}
-(void)initUI {
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
*/
@end
...@@ -19,13 +19,16 @@ ...@@ -19,13 +19,16 @@
-(void)progressBarTimeArray:(NSArray *)array Totaltime:(CGFloat)time{ -(void)progressBarTimeArray:(NSArray *)array Totaltime:(CGFloat)time{
if (array.count== 0) {
return;
}
[self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)]; [self.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
NSMutableArray *timeArray = [NSMutableArray arrayWithCapacity:0]; NSMutableArray *timeArray = [NSMutableArray arrayWithCapacity:0];
for (int i = 0; i<array.count; i++) { for (int i = 0; i<array.count; i++) {
if (i == array.count-1) { if (i == array.count-1) {
[timeArray addObject:[NSNumber numberWithFloat:(time- [array[i] floatValue])]]; [timeArray addObject:[NSNumber numberWithFloat:(time- [array[i] floatValue])]];
}else { }else {
[timeArray addObject:array[i+1]]; [timeArray addObject:[NSNumber numberWithFloat:([array[i+1] floatValue]-[array[i] floatValue])]];
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment