user1268135
user1268135

Reputation: 57

How to play a song from specified point of time in AVAudioPlayer

I am new to iphone.I am working on a project belongs to audio player in that i am struck in the middle because of here in my project i have mp3 song in resources and i have play that entire song (which is having 5 minutes duration )correctly but my task is,start a song from a specified point in the audio.how it is possible if any body know this please help me..

Upvotes: 1

Views: 901

Answers (1)

Omar Abdelhafith
Omar Abdelhafith

Reputation: 21221

This could be achieved like this

NSURL *urlOfSong = [[NSURL alloc] initFileURLWithPath: soundFilePath];
AVAudioPlayer *newPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:urlOfSong error: nil];
[newPlayer setCurrentTime:Time_Of_Play];

Upvotes: 4

Related Questions