Android Question Webview Loaded Page Not Excepting Click

bocker77

Active Member
Licensed User
Longtime User
I load an external web page and on this page is an icon. When pressed it is supposed to read with text-to-speech a portion of the text on the page. For some reason it does not work when loaded into a B4A webview but works if I load the same page in Chrome. This of course is on the same android device. The icon acknowledges my finger click as it turns the background a shade of blue but nothing happens. When working on Chrome it changes the icon to an icon with a red line through it (see below). On the webview it DOES work when pressing links on the same page. I tried adding addWebChromeClient to my code but no go. Hopefully there is an easy answer to this. If anyone would like to test the website on a webview it is "https://www.hmdb.org/". I tried it on two separate devices.

 

bocker77

Active Member
Licensed User
Longtime User
As a side note I am grabbing the HTML code and parsing out the text. I then send it to B4A's text-to-speech but there are issues in doing this ,like not finding the end of the text. So I thought that it would be easier through javascript to just initiate the page's option.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
SpeechSynthesisUtterance is not supported by webview.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
many hopes have been dashed on the shores of webview. it's only a subset of chrome. if the only purpose is to hear some text to speech, you could run chrome as an intent from your app. sometimes you gotta do what you gotta do...
 
Upvote 0

bocker77

Active Member
Licensed User
Longtime User
I am just parsing out the text and using B4A Text-to-speech engine. This also allows me to change abbreviations so it sounds better. The website doesn't and any abbreviation of course doesn't sound that good.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
sorry, not clear to me exactly why you want webview to read the text if you're grabbing the text yourself and "reading" it yourself with android's standard text to speech engine. you don't need the webview for anything, no? i'm guessing you're simply downloading the page with okhttputils and going from there. assuming the text is actually in the page (and not dynamically added later), there should be no problem. are you having a problem (besides webview's not dealing with a specific synthesizer)?
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…