Tuesday, 15 January 2013

ios - AVPlayer seekTo not accurate -



ios - AVPlayer seekTo not accurate -

so have hls stream have avplayer playing. trying create button jump 30 seconds so:

- (void) rewindstream { nslog(@"seeking..."); nslog(@"current time: %f", cmtimegetseconds(self.player.currenttime)); nslog(@"new time: %f", cmtimegetseconds(cmtimemakewithseconds(cmtimegetseconds(self.player.currenttime) - 30.0f, self.player.currenttime.timescale))); [self.player pause]; cmtime cmtime = cmtimemakewithseconds(cmtimegetseconds(self.player.currenttime) - 30.0f, self.player.currenttime.timescale); [self.player seektotime:cmtime tolerancebefore:kcmtimezero toleranceafter:kcmtimezero completionhandler:^(bool finished) { nslog(@"complete. current time: %f", cmtimegetseconds(self.player.currenttime)); [self.player play]; }]; }

which works sometimes, not others. here log:

seeking... current time: 47.253361 new time: 37.254001 complete. current time: 37.254944 seeking... current time: 59.409800 new time: 49.410447 complete. current time: 50.103244 seeking... current time: 68.780054 new time: 58.780436 complete. current time: 60.086244 seeking... current time: 80.493733 new time: 70.494375 complete. current time: 80.140578 seeking... current time: 92.674773 new time: 82.675062 complete. current time: 110.135244

i have tolerance set, , making sure give plenty time segments download/buffer seeking possible, not sure issue be.

any help appreciated.

thanks.

i utilize timescale of 60000 gives plenty accuracy anything. not sure if issue i've found of cmtime problems came before settled on this. warren moore has great post describing @ http://warrenmoore.net/understanding-cmtime

ios objective-c stream streaming avplayer

No comments:

Post a Comment