iphoneiosxcodeavplayercmtime

AVPlayer - Add Seconds to CMTime


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?


Solution

  • Here is one way:

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