文本到语音-需要帮助找到音频不能在Apache Cordova 2.3.0rc1中播放的原因



我正在尝试使用谷歌的TTS服务将mp3拉入我的PhoneGap (Cordova 2.3.0rc1)应用程序并播放它们。

我需要更多的信息,为什么音频停止为我工作。其他人能确认它是否有效吗?

:

{
    var url = 'http://translate.google.com/translate_tts?tl=en&q=are+you+messing+with+me?';
    var snd = new Audio(url);
    snd.load();
    snd.play();
}

结果如下:

2012-12-24 16:45:54.365 myAPP[1614:907] [LOG] HTML5 audio capable.
2012-12-24 16:45:56.413 myAPP[1614:907] [MPAVController] Autoplay: Enabling autoplay
2012-12-24 16:45:56.437 myAPP[1614:907] [MPAVController] Autoplay: Skipping autoplay, disabled (for current item: 0, on player: 1)
2012-12-24 16:45:57.227 myAPP[1614:907] [MPAVController] Autoplay: Disabling autoplay for pause
2012-12-24 16:45:57.230 myAPP[1614:907] [MPAVController] Autoplay: Disabling autoplay
2012-12-24 16:45:57.280 myAPP[1614:907] [MPAVController] Autoplay: Enabling autoplay
2012-12-24 16:45:57.414 myAPP[1614:907] [MPCloudAssetDownloadController] Prioritization requested for media item ID: 0
2012-12-24 16:45:57.480 myAPP[1614:907] [MPAVController] Autoplay: Enabling autoplay
2012-12-24 16:45:57.522 myAPP[1614:907] [MPAVController] Autoplay: Enabling autoplay 
2012-12-24 16:45:57.609 myAPP[1614:907] [MPCloudAssetDownloadController] Prioritization requested for media item ID: 0 
2012-12-24 16:46:01.150 myAPP[1614:907] [MPAVController] Autoplay: Likely to keep up or full buffer: 0 
2012-12-24 16:46:01.153 myAPP[1614:907] [MPAVController] Autoplay: Skipping autoplay, not enough buffered to keep up. 
2012-12-24 16:46:01.163 myAPP[1614:907] [MPAVController] Autoplay: _streamLikelyToKeepUp: 0 -> 1 
2012-12-24 16:46:01.166 myAPP[1614:907] [MPAVController] Autoplay: Likely to keep up or full buffer: 1 
2012-12-24 16:46:01.191 myAPP[1614:907] [MPAVController] Autoplay: Enabling autoplay 
2012-12-24 16:46:03.346 myAPP[1614:907] [MPAVController] Autoplay: _streamUnlikelyToKeepUp: 1 -> 0 
2012-12-24 16:46:03.352 myAPP[1614:907] [MPAVController] Autoplay: Likely to keep up or full buffer: 0 
2012-12-24 16:46:03.355 myAPP[1614:907] [MPAVController] Autoplay: Skipping autoplay, not enough buffered to keep up. 
2012-12-24 16:46:03.358 myAPP[1614:907] [MPAVController] Autoplay: _streamRanDry: 0 -> 1 
2012-12-24 16:46:03.389 myAPP[1614:907] [MPAVController] Autoplay: Took background task assertion (8) for playback stall 
2012-12-24 16:46:03.398 myAPP[1614:907] [MPAVController] Autoplay: Likely to keep up or full buffer: 0 
2012-12-24 16:46:03.403 myAPP[1614:907] [MPAVController] Autoplay: Skipping autoplay, not enough buffered to keep up. 
2012-12-24 16:46:03.405 myAPP[1614:907] [MPAVController] Autoplay: Disabling autoplay 
2012-12-24 16:46:03.408 myAPP[1614:907] [MPAVController] Autoplay: Disabling autoplay for pause 
2012-12-24 16:46:03.411 myAPP[1614:907] [MPAVController] Autoplay: Disabling autoplay

另一种选择是做一个jquery下载和播放它的div....?

音频标签api在web视图中不受很好的支持,这可能是你遇到问题的地方。您可能需要切换到使用PhoneGap Media API来播放mp3文件。在某种程度上,我一直想重写这个API以符合音频API,但我还没有时间。

另外,如果你只是想TTS的东西,你为什么不使用我写的TTS插件在设备上做转换?

最新更新