SpeakHere样品不能播放从互联网加载的声音 [英] SpeakHere sample can't play sound which loads from internet

查看:126
本文介绍了SpeakHere样品不能播放从互联网加载的声音的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想打从互联网加载的声音文件,所以我试图从iPhone SDK SpeakHere样品开始。我录了音,然后保存并上传到互联网,我可以下载该文件,并从声音工具没有问题玩。但是,当我试图播放从SpeakHere该URL,我得到错误程序接收到的信号:EXC_BAD_ACCESS

I'd like to play sound file which loaded from internet, so I tried to start from iPhone SDK SpeakHere sample. I recorded the sound, then saved and uploaded to the internet, I could download that file and play without problem from sound tools. But when I tried to play that URL from SpeakHere, I am getting error Program received signal: "EXC_BAD_ACCESS".

跟踪左右后,我发现,在 - [AudioPlayer calculateSizesFor:] ,其设置 bufferByteSize 来一大量806128768,造成缓冲区分配失败。

After trace around, I found that the in -[AudioPlayer calculateSizesFor:], it set bufferByteSize to a huge number 806128768, which caused buffer allocation failed.

这是因为

AudioFileGetProperty(audioFileID, kAudioFilePropertyPacketSizeUpperBound, &propertySize, &maxPacketSize);

maxPacketSize 返回为806128768。

The maxPacketSize returned is 806128768.

我想知道如何使 AudioFileGetProperty 工作

我的声音文件这里
你可以右键单击并从这里 下载。

My sound file is here, you could right-click and download from here.

我使用这种方式设置在的URL - [AudioViewController playOrStop] 方法:

I am using this way to set the URL in the -[AudioViewController playOrStop] method:

// AudioPlayer *thePlayer = [[AudioPlayer alloc] initWithURL: self.soundFileURL];
AudioPlayer *thePlayer = [[AudioPlayer alloc] initWithURL:
    [NSURL URLWithString: @"http://chineseresume.com/localbiz/uploads/myfilename_7_Recording.caf"]];

任何建议是非常值得欢迎的。

Any suggestion is highly welcome.

推荐答案

是的,你需要使用<一个href=\"http://developer.apple.com/iphone/library/documentation/MusicAudio/Reference/AudioStreamReference/Reference/reference.html\"相对=nofollow>音频文件流服务直接从互联网上播放。

Yes, you need to use Audio File Stream Services to play directly from the internet.

我发现了AudioFileStreamExample的例子是有用的,它应安装在

I found the "AudioFileStreamExample" example useful, which should be installed in

/Developer/Examples/CoreAudio/Services/AudioFileStreamExample/

此外,马特·加拉格尔有一篇文章叫做流和播放MP3流,包括iPhone例如code。我还没有仔细看,但似乎它可能对您有所帮助。

Also, Matt Gallagher has an article called "Streaming and playing an MP3 stream" that includes iPhone example code. I haven't looked at it carefully, but it seems like it may be helpful to you.

这篇关于SpeakHere样品不能播放从互联网加载的声音的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆