在webview中播放网站的声音?

时间:2016-06-23 07:59:36

标签: java android webview text-to-speech

Hello scripterfriends,我正在开发一个从网站上读取文本的应用程序。我们已经在网站浏览中创建了该网站(medispeak.eu)并打开了该网站。但问题是,文本到语音功能在应用程序内部不起作用,但它在常规浏览器中起作用。 有谁知道如何解决这个问题?

这是错误日志:

  

6-23 09:53:51.889 17188-17188 / hobby_pc.medispeak I / chromium:   [INFO:CONSOLE(8)]" ResponsiveVoice r1.4.7",来源:   https://code.responsivevoice.org/responsivevoice.js(8)06-23   09:53:51.999 17188-17188 / hobby_pc.medispeak V / ActivityThread:   updateVisibility:ActivityRecord {369df6d0   token=android.os.BinderProxy@38d5c740   {hobby_pc.medispeak / hobby_pc.medispeak.MainActivity}}显示:false   06-23 09:53:52.149 17188-17188 / hobby_pc.medispeak I / chromium:

     

[INFO:CONSOLE(47)]" RV:语音合成不受支持",来源:   https://code.responsivevoice.org/responsivevoice.js(47)06-23   09:53:52.149 17188-17188 / hobby_pc.medispeak I / chromium:

     

[INFO:CONSOLE(49)]" RV:启用后备模式",来源:   https://code.responsivevoice.org/responsivevoice.js(49)

 I/chromium: [INFO:CONSOLE(99)] "speak.js: worker processing took 12513.00  ms", source: http://www.medispeak.eu/speakClient.js (99)
 06-23 09:52:15.789 12277-12277/hobby_pc.medispeak I/chromium: [INFO:CONSOLE(0)] "Failed to execute 'play' on 'HTMLMediaElement': API can only be initiated by a user gesture.", source: http://www.medispeak.eu/ (0)
 06-23 09:52:15.799 12277-12277/hobby_pc.medispeak I/chromium: [INFO:CONSOLE(86)] "speak.js: wav processing took 2838.00 ms", source: http://www.medispeak.eu/speakClient.js (86)
 06-23 09:52:17.709 12277-12277/hobby_pc.medispeak I/chromium: [INFO:CONSOLE(59)] "Uncaught (in promise) NotAllowedError: play() can only be initiated by a user gesture.", source: http://www.medispeak.eu/speakClient.js (59)

1 个答案:

答案 0 :(得分:1)

尝试使用高级webview库, 例如,AdvancedWebView