I'm developing an app that records and plays back audio (using Cordova 2.1.0). Basically there is a list of audio resources and an <audio>
tag. The user taps one of the items on the list, the URL to an audio file on a remote server is added to the tag, and then played. This works fine, at first.
There is also a button which allows the user to record new audio, using Cordova's Media
object. The media is recorded, encoded to AAC using AudioEncode plugin, and uploaded. The list is refreshed with the new audio file. This all works as intended as well.
Now, after using the Media object, I try to play any of the audio files, it fails. (I am not using Media to play the audio, however. I'm actually using Sencha Touch's Audio.play()
).
In iOS 5, the whole process worked as expected throughout. After upgrading to iOS 6, audio will not play after having recorded new audio. Has anyone encountered a similar issue? Have solutions or workarounds?
UPDATE: I recently noticed that if the audio is played after recording (Media.play()
), and then uploaded, it does not interfere with subsequent audio streaming. However, if the user records audio, then uploads without playing it, all audio streaming is broken from that point on.
This is what the console shows when the audio plays properly:
[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
This is what the console shows when it fails:
[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