I need to create a custom video plugin using swift. But I don't know how to get video full duration and current playing time. In my console just appeared this output, C.CMTime
. I'm not sure what wrong with my code.
My code
let url = NSBundle.mainBundle().URLForResource("Video", withExtension:"mp4")
let asset = AVURLAsset(URL:url, options:nil)
let duration: CMTime = asset.duration
println(duration)
You can use CMTimeGetSeconds to converts a CMTime to seconds.
let durationTime = CMTimeGetSeconds(duration)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With