我正在开发一个记录和播放音频的应用程序(使用 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