ios - how to trim or crop music from itunes library -
i grab music user's library audio music fingering. required 30 sec of each songs. how go ? not need save audio using it.
are above 2 links way go ?
thanks reading , appreciated comments.
cheers
to access music user has in device library, use mpmediaitemcollection class. sample code on using (although old , not using arc) can found in apple docs in "add music" sample.
i not sure audio player using, if seek particular point in song or audio file, can using currenttime
property in avaudioplayer class, (noted in apple docs).
to implement this, simple as:
youraudioplayer.currenttime = 60;
this jump song 1 minute mark. not 100% sure on how before song plays, put in play ibaction, before starts playing:
- (ibaction) playorpause: (id) sender { if (self.player.playing) { [self.button settitle: @"play" forstate: uicontrolstatehighlighted]; [self.button settitle: @"play" forstate: uicontrolstatenormal]; [self.player pause]; } else { [self.button settitle: @"pause" forstate: uicontrolstatehighlighted]; [self.button settitle: @"pause" forstate: uicontrolstatenormal]; [self.player.currenttime = 60]; //set seeker here [self.player play]; } }
to stop playback after amount of time (you 30 sec) use nstimer call stop
on player after 30 second delay. like:
[nstimer scheduledtimerwithtimeinterval:30.0 target:self.player selector:@selector(stop) userinfo:nil repeats:no];
if put in ibaction use play, should it!
Comments
Post a Comment