播放音频文件,持续使用音频录制的url。

时间:2023-01-19 18:58:33

I am newcomer in Objective-C and have experience only 12 months in iPhone development.

我是Objective-C的新人,在iPhone开发中只经历了12个月。

I am recording audio files in One UIViewController, and playing on another UIViewController. For playing purpose i am saving the date string for generation of url,it is fine working properly, But ,now my problem is i want to play previous audio record file for some time after that i want to play next audio file using url . i am saving all the data using nsuser dafaults please help me

我在一个UIViewController中录制音频文件,并在另一个UIViewController上播放。为了达到目的,我保存了生成url的日期字符串,它可以正常工作,但是,现在我的问题是,我想播放之前的音频记录文件,之后我想使用url播放下一个音频文件。我正在用nsuserdafaults保存所有的数据,请帮助我。

NSM![enter image description here][1]utableArray *dateString;
NSURL recordFile = [NSURL fileURLWithPath:[NSTemporaryDirectory() stringByAppendingString:[self.dateString objectAtIndex:sender.tag]]];
For playing

player = [[AVAudioPlayer alloc] initWithContentsOfURL:recordFile error:&error];

from fig when i click a tag 2 i want to play first 5 sec tag1 after that i want to play tag2

从图中,当我点击标签2时,我想要播放前5秒的标签,然后我想播放tag2。

1 个解决方案

#1


0  

Record the audio -> Save the audio in the Temp -> Track the saved path of the audio file (You can store this saved path in an array) . Repeat the same steps for the next file.

将音频->保存在Temp ->中,跟踪音频文件的保存路径(您可以将此保存的路径存储在数组中)。对下一个文件重复相同的步骤。

Use AVQueuePlayerfor playing items one after the other.

使用AVQueuePlayerfor,一个接一个地播放项目。

#1


0  

Record the audio -> Save the audio in the Temp -> Track the saved path of the audio file (You can store this saved path in an array) . Repeat the same steps for the next file.

将音频->保存在Temp ->中,跟踪音频文件的保存路径(您可以将此保存的路径存储在数组中)。对下一个文件重复相同的步骤。

Use AVQueuePlayerfor playing items one after the other.

使用AVQueuePlayerfor,一个接一个地播放项目。