Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] JS API: AnkiDroidJS.ankiTtsSpeak(text) should strip/ignore html #13107

Open
3 of 4 tasks
sudomain opened this issue Jan 12, 2023 · 10 comments
Open
3 of 4 tasks

[Bug] JS API: AnkiDroidJS.ankiTtsSpeak(text) should strip/ignore html #13107

sudomain opened this issue Jan 12, 2023 · 10 comments
Labels
Audio Blocked by dependency Currently blocked by some other dependent / related change JS API

Comments

@sudomain
Copy link
Contributor

I'm attempting to make a replay tts button on a template:

Reproduction Steps
  1. Create a Basic note type with a template as so:
<!-- initial tts when the card is rendered on AnkiDroid -->
<tts service="android" voice="en_US">{{Front}}</tts>

<!-- initial tts when the card is rendered on Anki desktop -->
<span class="ankitts">{{tts en_US:Front}}</span>

<!-- TTS replay button on AnkiDroid -->
<button class="ankidroidTtsButton" onclick="
AnkiDroidJS.ankiTtsSpeak('{{Front}}');">Play TTS</button>
  1. Create a note of this note type with a Front field containing:
Test front 1 <b>2</b> 3
  1. Review the resulting card. When initially rendering the card, the tts service will correctly read Test front 1 2 3 and ignore the b html tags. The replay button using the JS API will incorrectly read out the element: Test front 1 less than sign b greater than sign 2 less than sign slash b greater than sign 3
Expected Result

The same behavior as when using the tts HTML tags: embedded HTML elements shouldn't be read by ankiTtsSpeak().

Actual Result

embedded HTML elements are read

Debug info

Refer to the support page if you are unsure where to get the "debug info".

AnkiDroid Version = 2.16alpha92

Android Version = 11

Manufacturer = Google

Model = Pixel 2

Hardware = walleye

Webview User Agent = Mozilla/5.0 (Linux; Android 11; Pixel 2 Build/RP1A.201005.004.A1; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/106.0.5249.126 Mobile Safari/537.36

ACRA UUID = edb11ce0-7c90-482d-9915-9e02591297f0

New schema = false

Scheduler = std2

Crash Reports Enabled = true

DatabaseV2 Enabled = true

Research

Enter an [x] character to confirm the points below:

  • I have read the support page and am reporting a bug or enhancement request specific to AnkiDroid
  • I have checked the manual and the FAQ and could not find a solution to my issue
  • I have searched for similar existing issues here and on the user forum
  • (Optional) I have confirmed the issue is not resolved in the latest alpha release (instructions)
@sudomain
Copy link
Contributor Author

Related: the ankiTtsSpeak() will continue reading text it was given when going back to the deck list, unlike the html tags which will stop reading of going back to the deck list

@github-actions
Copy link
Contributor

Hello 👋, this issue has been opened for more than 3 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Jun 12, 2023
@sudomain
Copy link
Contributor Author

I don't really use AnkiDroid anymore since I started running Anki desktop on my phone (via Termux and proot-distro). As far as I know it's still an issue, but not for me

@github-actions github-actions bot removed the Stale label Jun 12, 2023
@dae
Copy link
Contributor

dae commented Sep 1, 2023

With 2.17 standard Anki TTS tags will be supported, which should handle this correctly. I'm not sure what the AD devs want to do with the AnkiDroid-specific TTS tags.

Copy link
Contributor

Hello 👋, this issue has been opened for more than 3 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Nov 30, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Dec 7, 2023
@david-allison david-allison reopened this Dec 7, 2023
@david-allison
Copy link
Member

david-allison commented Dec 7, 2023

@krmanik

Just so you're aware of a user request, I expect this is blocked on TTS

We're going to be deprecating ReadText reading the entirety of the card in a few versions maximum (ideally starting to warn users in 2.17, probably removing in 2.19)

We're still going to support TTS via {{tts}} and there's nothing stopping us from sending arbitrary input into the TTS Engine

This seems like a reasonable request: a user wants an API for TTS to read out field contents in the same way that {{tts <options>: Front}} would

@david-allison david-allison added Audio JS API Blocked by dependency Currently blocked by some other dependent / related change labels Dec 7, 2023
@krmanik
Copy link
Member

krmanik commented Dec 7, 2023

Then JS API for TTS also needs to be upgraded.

Copy link
Contributor

github-actions bot commented Mar 6, 2024

Hello 👋, this issue has been opened for more than 3 months with no activity on it. If the issue is still here, please keep in mind that we need community support and help to fix it! Just comment something like still searching for solutions and if you found one, please open a pull request! You have 7 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Mar 6, 2024
@sudomain
Copy link
Contributor Author

sudomain commented Mar 6, 2024

Please tag "keep open"

@krmanik
Copy link
Member

krmanik commented Mar 6, 2024

I will create PR to fix this issue later which update JS API.

@github-actions github-actions bot removed the Stale label Mar 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Audio Blocked by dependency Currently blocked by some other dependent / related change JS API
Projects
None yet
Development

No branches or pull requests

4 participants