在iOS6 + PhoneGap中流式传输音频

时间:2012-10-04 19:32:32

标签: ios cordova ios6

我正在开发一个记录和播放音频的应用程序(使用Cordova 2.1.0)。基本上有一个音频资源列表和一个<audio>标签。用户点击列表中的一个项目,将远程服务器上的音频文件的URL添加到标签,然后播放。一开始这很好。

还有一个按钮,允许用户使用Cordova的Media对象录制新的音频。媒体被记录,使用AudioEncode插件编码到AAC,并上传。该列表将使用新的音频文件刷新。这一切都按预期工作。

现在,在使用Media对象后,我尝试播放任何音频文件,它失败了。 (但我没有使用Media播放音频。我实际上正在使用Sencha Touch的Audio.play())。

在iOS 5中,整个过程始终如预期。升级到iOS 6后,录制新音频后音频将无法播放。有没有人遇到类似的问题?有解决方案或解决方法吗?

更新:我最近注意到,如果在录制(Media.play())之后播放音频,然后上传,则不会干扰后续音频流。但是,如果用户录制音频,然后上传而不播放,则所有音频流都会从此处断开。

这是音频播放时控制台显示的内容:

[MPAVController] Autoplay: Enabling autoplay
[MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 0, on player: 1)
[MPAVController] Autoplay: Enabling autoplay
[MPCloudAssetDownloadController] Prioritization requested for media item ID: 0
[MPAVController] Autoplay: Enabling autoplay
[MPAVController] Autoplay: Enabling autoplay
[MPCloudAssetDownloadController] Prioritization requested for media item ID: 0
[MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 0, on player: 1)
[MPAVController] Autoplay: Disabling autoplay for route change
[MPAVController] Autoplay: Disabling autoplay
[MPAVController] Autoplay: Enabling autoplay
[MPAVController] Autoplay: _streamLikelyToKeepUp: 0 -> 1
[MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 0, on player: 1)
(Plays audio here)
[MPAVController] Autoplay: Disabling autoplay
[MPAVController] Autoplay: Disabling autoplay for pause
[MPAVController] Autoplay: Disabling autoplay
[MPAVController] Autoplay: _streamLikelyToKeepUp: 1 -> 1

这是控制台失败时显示的内容:

[MPAVController] Autoplay: Enabling autoplay
[MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 0, on player: 1)
[MPAVController] Autoplay: Disabling autoplay for pause
[MPAVController] Autoplay: Disabling autoplay
[MPAVController] Autoplay: Enabling autoplay
[MPCloudAssetDownloadController] Prioritization requested for media item ID: 0
[MPAVController] Autoplay: Enabling autoplay
[MPAVController] Autoplay: Enabling autoplay
[MPCloudAssetDownloadController] Prioritization requested for media item ID: 0
[MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 0, on player: 1)
[MPAVController] Autoplay: Enabling autoplay
[MPAVController] Autoplay: _streamLikelyToKeepUp: 0 -> 1
[MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 0, on player: 1)
[MPAVController] Autoplay: Disabling autoplay for pause
[MPAVController] Autoplay: Disabling autoplay

0 个答案:

没有答案