36 lines
858 B
Objective-C
36 lines
858 B
Objective-C
//
|
||
// AVLiveStreamModel.m
|
||
// AVDemo
|
||
//
|
||
|
||
#import "AVLiveStreamModel.h"
|
||
|
||
@implementation AVLiveStreamModel
|
||
|
||
+ (NSDictionary *)modelCustomPropertyMapper {
|
||
return @{
|
||
@"xorKey" : @"xor_key"
|
||
};
|
||
}
|
||
|
||
- (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
|