3

我有几个关于音频流的问题:

我想要做的是流一些 mp3 文件,在 3 到 7 分钟之间(主要是音乐文件),但这些 mp3 是由不是我的服务器提供的。我确切地说我当然希望我的应用程序在应用程序商店中被接受......

1°/ 我需要通过 http 传输一些 mp3 音乐文件,它们以 128Kbps 编码。我真的需要 HTTP Live Streaming 服务 (HLS) 吗?

2°/如果我必须使用 HLS,我是否必须将我的 mp3 文件重新编码为 64Kbps 或只是将它们分段?

谢谢!

4

1 回答 1

0

我正在使用此代码播放音频..据我所知,您不需要使用 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];
}
于 2012-06-02T15:53:09.717 回答