osx - AVPlayer seekToTime -
i using periodictimeobserverforinterval update plot reflect current audio waveform. works great , has been giving me no trouble. stays in sync pausing , starting. however, when tried introduce arbitrary seeking code, waveform visual becomes out of sync playing audio. doesn't make sense me unless time sent observer wrong after calling seek function.
// timescale = 22050 = samplerate let timescale = self.player.currentitem.asset.duration.timescale; self.player.seektotime(cmtimemakewithseconds(float64(time), timescale), tolerancebefore: kcmtimezero, toleranceafter: kcmtimezero, completionhandler: { (bool) -> void in self.player.play(); });
i can't figure out why function causing visual out of sync.
Comments
Post a Comment