簡體   English   中英

iOS 如何從由 Date().timeIntervalSince1970 創建的 Int64 獲取 CMTime

[英]iOS how can I get CMTime from Int64 that create by Date().timeIntervalSince1970

與標題相同,我通過 Date().timeIntervalSince1970 獲得時間戳,如何將其轉換為 CMTime?

extension TimeInterval {
    func toCMTime() -> CMTime {
        let scale = CMTimeScale(NSEC_PER_SEC)
        let rt = CMTime(value: CMTimeValue(self * Double(scale)), timescale: scale)
        return rt
    }
}

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM