Files
HaishinKit.swift/HaishinKit/Sources/Extension/CMTime+Extension.swift
2025-10-01 23:30:06 +09:00

16 lines
391 B
Swift

import AVFoundation
import Foundation
extension CMTime {
func makeAudioTime() -> AVAudioTime {
return .init(sampleTime: value, atRate: Double(timescale))
}
func convertTime(from: CMClock?, to: CMClock? = CMClockGetHostTimeClock()) -> CMTime {
guard let from, let to else {
return self
}
return from.convertTime(self, to: to)
}
}