Video playback progress and restoring time for previously played

This commit is contained in:
Arkadiusz Fal
2021-10-22 22:49:31 +02:00
parent bc065e282a
commit 4307da57c5
13 changed files with 219 additions and 89 deletions

View File

@@ -0,0 +1,17 @@
import Foundation
extension Double {
func formattedAsPlaybackTime() -> String? {
guard !isZero else {
return nil
}
let formatter = DateComponentsFormatter()
formatter.unitsStyle = .positional
formatter.allowedUnits = self >= (60 * 60) ? [.hour, .minute, .second] : [.minute, .second]
formatter.zeroFormattingBehavior = [.pad]
return formatter.string(from: self)
}
}