关于音频流,我有几个问题:
我想做的是流式传输一些mp3文件,在3到7分钟之间(主要是音乐文件),但这些mp3是由不是我的服务器提供的。我精确地说,我希望我的应用程序能被应用程序商店接受……
1°/我需要通过http传输一些mp3音乐文件,它们是以128Kbps编码的。我真的需要HTTP Live Streaming服务(HLS)吗?
2°/如果我必须使用HLS,我是必须将我的mp3文件重新编码为64Kbps,还是只对它们进行分段?
谢谢!
发布于 2012-06-02 23:53:10
我正在使用这段代码来播放audio..As,我知道你不需要使用HLS,你可以按原样流传输。或者你必须移动音频的元数据..我已经在另一个答案iPhone/iPad Downloading and Playing Simultaneously中给出了步骤。请检查..
// 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];
}https://stackoverflow.com/questions/10862596
复制相似问题