objective c - Convert from NStimeInterval to CMTime accurately -
i using 2 players 1 mpmovieplayercontroller
, other avplayer
. henever mpmovieplayercontroller
seeked, sets time avplayer
. working fine. while converting mpmovieplayercontroller
current time cmtime
rounding off ex:(if mpplayer time 11.80132 rounding 11).
without rounding off, how can set time avplayer
?
code getting mpplayer time , sending avplayer
class
[avplayerclass setcurrenttime:[self.videoplayer currentplaybacktime]]; nslog(@"currenttime:%f",[self.videoplayer currentplaybacktime]);//11.801345
code in avplayer
class , converting time cmtime
-(void)setcurrenttime:(nstimeinterval)seektime { cmtime seekingcm = cmtimemake(seektime, 1); [self.player seektotime:seekingcm tolerancebefore:kcmtimezero toleranceafter:kcmtimepositiveinfinity]; [self.player seektotime:seekingcm]; nslog(@"current time123ns%%%%%%:%f",cmtimegetseconds(seekingcm));//11 nslog(@"current time123ns%%%%%%:%f",seektime);//11.801345 }
try :
cmtime seekingcm = cmtimemakewithseconds(playbacktime, 1000000);
Comments
Post a Comment