Using AVPlayerItem, how can i use a string to specify the path to the file
id like to play?
My mp3 files are small, each file is just one word being spoken. I have a
UIPickerView setup with 3 columns, and depending on which rows are
selected, it will play those specific words in sequence when the button is
pressed. Any good advice on how i may accomplish that?
i'm currently trying to do this but get an error
-(IBAction)sequencePlay:(id)sender
{
NSString *sayFirst = _firstRowWord.description;
AVPlayerItem *firstSound = [[AVPlayerItem alloc] initWithURL:[NSURL
fileURLWithPath:[[NSBundle mainBundle]
pathForResource:sayFirst.description ofType:@"mp3"]]];
i get the following error * Terminating app due to uncaught exception
'NSInvalidArgumentException', reason: '* -[NSURL initFileURLWithPath:]:
nil string parameter'
the description of the firstRowWord is the same exact name as the mp3 file
i want to play
No comments:
Post a Comment