0

我正在尝试使用 google 的 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 中播放它......?

4

1 回答 1

0

那么音频标签 api 在 web 视图中没有得到很好的支持,这可能是您遇到问题的地方。您可能想要切换到使用PhoneGap Media API来播放您的 mp3 文件。在某些时候,我一直打算重新编写这个 API 以符合音频 API,但我还没有时间。

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

于 2012-12-27T15:39:54.020 回答