简体   繁体   English

Audio Streamer在iPad上可用,但在iPhone上不可用

[英]Audio Streamer works on iPad but not on iPhone

I have created an app which streams audio from a webserver. 我创建了一个应用程序,可从网络服务器传输音频。

The music player in the app works fine if it is installed: 如果已安装,则该应用中的音乐播放器可以正常运行:

  • As iPhone app on iPad 2 作为iPad 2上的iPhone应用程序

  • In iPhone Simulator 在iPhone模拟器中

But it does not work on iPhone 3G device. 但它不适用于iPhone 3G设备。

What could be wrong? 有什么事吗

Just to give you a background: 只是给你一个背景:

I have two views. 我有两种看法。 One view (MainView) is suppose to play song "ABC". 一种视图(MainView)应该播放歌曲“ ABC”。 When user clicks another view (Detail View), it should pause "ABC" and should start song "XYZ". 当用户单击另一个视图(详细信息视图)时,它将暂停“ ABC”并开始播放歌曲“ XYZ”。

Here's what happens on: 以下是发生的情况:

iPhone Device: When we go to Detail View, it pauses songs "ABC", but after few seconds, it again starts "ABC" instead of "XYZ". iPhone设备:当我们进入“详细信息视图”时,它将暂停歌曲“ ABC”,但是几秒钟后,它将再次启动“ ABC”而不是“ XYZ”。

iPhone Simulator & iPhone app on iPad: When we go to Detail View, it pauses song "ABC" and plays "XYZ". iPad上的iPhone Simulator和iPhone应用程序:当我们转到“详细信息视图”时,它将暂停歌曲“ ABC”并播放“ XYZ”。 When we switch back to MainView it again starts playing "ABC" from where it left off. 当我们切换回MainView时,它将从中断处开始播放“ ABC”。

It looks like problem with Net connectivity but if that is the case then it should not play "ABC" also. 它看起来像是网络连接问题,但如果是这种情况,那么它也不应播放“ ABC”。

Can you please suggest what could be wrong? 您能建议出什么问题吗?

Thanks! 谢谢!

Here the code that I used for Audio Streamer: 这是我用于音频流媒体的代码:

- (void)createStreamer
{
NSLog(@"str_audio url:%@",str_AudioUrl);

if (streamer)
{
    return;
}
NSLog(@"create stremer %d",selectedIndex);
//[self destroyStreamer];

NSString *escapedValue = [(NSString *)CFURLCreateStringByAddingPercentEscapes(nil,//Here pass the string of url
                                                                              (CFStringRef)str_AudioUrl,
                                                                              //  (CFStringRef)downloadSourceField.text,
                                                                              NULL,NULL,kCFStringEncodingUTF8)autorelease];

//str_AudioUrl is my string where data come.


NSURL *url = [NSURL URLWithString:escapedValue];
streamer = [[AudioStreamer alloc] initWithURL:url];
NSLog(@"Streamer : %@",streamer);




}

Found bug with Audiostreamer class. 发现Audiostreamer类的错误。 Solution is found in this link: 在此链接中找到解决方案:

https://github.com/mattgallagher/AudioStreamer/issues/26 https://github.com/mattgallagher/AudioStreamer/issues/26

Hope this helps someone facing similar problem. 希望这可以帮助面临类似问题的人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM