var maxDuration : CMTime = CMTimeMake(seconds, preferredTimeScale)
aMovieFileOutput.maxRecordedDuration = CMTimeMake(seconds, preferredTimeScale)
1行有错误:使用模块' CMTime'作为一种类型 2行有错误:使用未解析的标识符' CMTimeMake'
我做错了什么?
答案 0 :(得分:21)
CMTime
和CMTimeMake
在" CoreMedia"中定义。模块,因此你必须
import CoreMedia
然后编译没有问题:
let seconds : Int64 = 10
let preferredTimeScale : Int32 = 1
let aMovieFileOutput = AVCaptureMovieFileOutput()
let maxDuration : CMTime = CMTimeMake(seconds, preferredTimeScale)
aMovieFileOutput.maxRecordedDuration = maxDuration
Swift 3的更新:
let maxDuration = CMTime(seconds: Double(seconds), preferredTimescale: 1)