我的第一个问题在这里播放的流音频,支持的MPMoviePlayerController ...在后台模式
我一直在寻找如何解决这一问题我使用MonoTouch的创建我的MPMoviePlayerController这样启动程序:
this.mp = new MPMoviePlayerController(new NSURL("http://stream3.dyndns.org:1935/iphone/xeco.stream/playlist.m3u8"));
this.mp.useApplicationAudioSession=false //also try with true
this.mp.PrepareToPlay();
this.mp.Play();
一切伟大工程,我听到声音
注:
我已经搜索如何解决这个问题,并在我的plist文件中添加UIBackgroundModes和字符串音频,因为许多成员建议。 (使用monotouch提供的plist编辑器)。还添加此代码设置我的音频会话的类别:
AudioSession.Initialize();
AudioSession.Interrupted += delegate{
Console.Writeline("interrupted");
}
AudioSession.Category = AudioSessionCategory.MediaPlayback; //also try ambientsound and others
的问题是:
我怎能音频播放时,应用程序变为背景,当设备块或家庭按钮被按下了?
当按回家或阻止设备时,流总是显示静音,当我返回到应用程序的音频开始非常迅速,这让我觉得应用程序一直在流,但只听不到。
我只在Iphone Simulator上测试,我开始认为这可能只是在模拟器上引起的。有什么建议?
在此先感谢。
UPDATE:
我收到我的MonoTouch的许可证和我在iOS开发程序寄存器,所以我在设备上测试我的应用程序。它的工作原理,重要的部分是在AudioSession部分:
AudioSessionCategory.MediaPlayback;
,并在使用播放器时:
this.mp.useApplicationAudioSession=false
我在周末遇到了同样的问题。我不相信你可以在模拟器上测试背景音频。如果将该应用程序部署到设备上,它将起作用。 [这里](http://stackoverflow.com/questions/3185621/is-it-possible-to-test-ios4-multitasking-background-music-playing-on-the-simulat)是一个相关的链接。另外[这里](https://github.com/bholmes/IOSSampleApps/tree/master/avTouch/avTouchCSApp)是我创建的示例应用程序,它是Apple的avTouch示例的扩展。 – holmes
感谢您的链接http://stackoverflow.com/questions/3185621/is-it-possible-to-test-ios4-multitasking-background-music-playing-on-the-simulat似乎这只是模拟器的一个问题。我希望本周能够在真实设备上进行测试,我将用结果更新这个问题。 – BeN
检查问题的更新 – BeN