AVPlayer - Add Seconds to CMTime

Lorenz Wöhr picture Lorenz Wöhr · Feb 26, 2013 · Viewed 17.7k times · Source

How can I add 5 seconds to my current playing Time?
Actually this is my code:

CMTime currentTime = music.currentTime;

I can´t use CMTimeGetSeconds() , because I need the CMTime format.

Thank you for your answers...

EDIT: How can I set a variable for CMTime?

Answer

BlueVoodoo picture BlueVoodoo · Feb 26, 2013

Here is one way:

CMTimeMakeWithSeconds(CMTimeGetSeconds(music.currentTime) + 5, music.currentTime.timescale);