tags:

views:

593

answers:

3

I'm using Media Player Framework to access the user's music library on iPhone. I would like to set the playback starting position so that I can start playing a song from 30 second mark, for example.

I have trouble finding out how to do this. The MPMediaPlayerController only offers beginSeekingForward but that's not quite what I'm looking for as it simply accelerates the playback speed.

There is probably something really simple that I'm missing.

A: 

Nope, this API is deliberately crippled, which is why you don't see any functions for opening, or streaming from, the media file.

Your only hope is lowering the volume and calling beginSeekingForward until currentPlaybackTime returns >= 30s.

Enjoy!

Rhythmic Fistman
+1  A: 

MPMusicPlayerController's property currentPlaybackTime is a writeable property, so adjusting the playback starting point can be done with player.currentPlaybackTime = 30.0

scatterbrain
A: 

You can use player.currentPlaybackTime to set the time, before you start playing and playback will start at your desired point.

mahboudz