Initial clean commit
This commit is contained in:
29
Example/SellyCloudSDK/Play/AVLiveStreamModel.m
Normal file
29
Example/SellyCloudSDK/Play/AVLiveStreamModel.m
Normal file
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// AVLiveStreamModel.m
|
||||
// AVDemo
|
||||
//
|
||||
|
||||
#import "AVLiveStreamModel.h"
|
||||
|
||||
@implementation AVLiveStreamModel
|
||||
|
||||
- (NSString *)displayName {
|
||||
return self.stream.length > 0 ? self.stream : @"未知流";
|
||||
}
|
||||
|
||||
- (NSString *)durationString {
|
||||
NSInteger totalSeconds = (NSInteger)self.duration;
|
||||
NSInteger hours = totalSeconds / 3600;
|
||||
NSInteger minutes = (totalSeconds % 3600) / 60;
|
||||
NSInteger seconds = totalSeconds % 60;
|
||||
|
||||
if (hours > 0) {
|
||||
// 大于1小时,显示 hh:mm:ss
|
||||
return [NSString stringWithFormat:@"%02ld:%02ld:%02ld", (long)hours, (long)minutes, (long)seconds];
|
||||
} else {
|
||||
// 1小时内,显示 mm:ss
|
||||
return [NSString stringWithFormat:@"%02ld:%02ld", (long)minutes, (long)seconds];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in New Issue
Block a user