我正在使用此代码播放音频..据我所知,您不需要使用 HLS,您可以按原样进行流式传输..或者您必须移动音频的元数据..我在另一个答案iPhone/中给出了步骤iPad同时下载和播放..请检查..
// add the necessary frameworks
#import <CoreAudio/CoreAudioTypes.h>
#import <AVFoundation/AVFoundation.h>
// put the code in .h file
AVAudioPlayer * avPlayer;
-(IBAction) stopPlayingAudio {
[avPlayer stop];
}
- (IBAction)showVoiceRecordingMenu
{
// Create an otherwise-empty alert sheet
avPlayer = [[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://test.com/audio/files/audioFile.mp3"] error:&error];
NSLog(@"%@", [filePath path] );
NSLog(@"%f", avPlayer.duration );
itsAudioDuration = avPlayer.duration;
[avPlayer prepareToPlay];
[avPlayer play];
}