Fix timeline view time padding

This commit is contained in:
Arkadiusz Fal
2022-08-27 02:43:47 +02:00
parent 1cf37e5a00
commit 5b785cc9c2
3 changed files with 10 additions and 16 deletions

View File

@@ -9,12 +9,16 @@ final class PlayerTimeModel: ObservableObject {
var player: PlayerModel?
var forceHours: Bool {
duration.seconds >= 60 * 60
}
var currentPlaybackTime: String {
if player?.currentItem.isNil ?? true || duration.seconds.isZero {
return Self.timePlaceholder
}
return currentTime.seconds.formattedAsPlaybackTime(allowZero: true) ?? Self.timePlaceholder
return currentTime.seconds.formattedAsPlaybackTime(allowZero: true, forceHours: forceHours) ?? Self.timePlaceholder
}
var durationPlaybackTime: String {
@@ -30,17 +34,7 @@ final class PlayerTimeModel: ObservableObject {
return Self.timePlaceholder
}
return withoutSegmentsDuration.formattedAsPlaybackTime() ?? Self.timePlaceholder
}
var durationAndWithoutSegmentsPlaybackTime: String {
var durationAndWithoutSegmentsPlaybackTime = "\(durationPlaybackTime)"
if withoutSegmentsPlaybackTime != durationPlaybackTime {
durationAndWithoutSegmentsPlaybackTime += " (\(withoutSegmentsPlaybackTime))"
}
return durationAndWithoutSegmentsPlaybackTime
return withoutSegmentsDuration.formattedAsPlaybackTime(forceHours: forceHours) ?? Self.timePlaceholder
}
func reset() {