0

I am trying to merge an audio in video but this custom audio does not necessarily from the beginning. The user listens for a music and then if the user feels like want to start the video recording, the user will tap on a button that starts the video recording while the music is playing.

So the user could start after 20 or 32 seconds after the audio started.

I have no problem in merging, but my problem is understanding how to set the CMTimeRange.Start using CMTime for my audio background.

The Start time value is a .NET's TimeSpan, now for example the user started after 32 seconds

var startTime = new TimeSpan(0,0,32);

or the user started after 53 seconds and then starts the video recording.

how do you translate this to CMTime?

jaysonragasa
  • 1,076
  • 1
  • 20
  • 40

1 Answers1

0

First, we get the seconds From TimeSpan by using

TimeSpan span;
double time = span.TotalSeconds

Then ,we have to understand CMTime and how to translate float values to it.

Here you can refer to .

CMTime has a value and a timescale field, and time = value/timescale .

ColeX
  • 14,062
  • 5
  • 43
  • 240