tetsuo
tetsuo

Reputation: 61

Is there a way of changing playback position using AudioKit / AKPlayer?

Been scratching my head with this one, to no avail.

Am just trying to find out how to instantly change the current playback position when using the AKAudioPlayer provided by AudioKit.

player.playhead is read-only, so cant be changed.

changing player.startTime whilst the player is already playing seems to change the playback position in terms of the reported .playhead position but the actual audio being played does not change position - am I missing something here?

Obviously I can stop audio and restart at new position but a several second expensive CPU gap is not desirable for a a simple mp3 / wav file player!

Any ideas?

Upvotes: 3

Views: 1068

Answers (2)

Ryan Francesconi
Ryan Francesconi

Reputation: 1006

We've added a new player called AKPlayer which will also allow scanning through the file. The player will stream from disk by default. This player is designed to fix some of the shortcomings in AKAudioPlayer.

Upvotes: 4

tetsuo
tetsuo

Reputation: 61

OK Aurelius pointed me in the right direction of a new class introduced a couple weeks ago called AKClipPlayer

Like the standard Apple AV class you can now set the .currentTime property (in seconds) (the AKAudioPlayer class did not allow this) - it seems to stop playback doing this though so don't forget to .play() your node right after - there is no glitch or pause, is seamless on an old iPhone6S

Upvotes: 1

Related Questions