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

Add word highlights #21

Closed
alexandrebrilhante opened this issue Jan 19, 2021 · 12 comments
Closed

Add word highlights #21

alexandrebrilhante opened this issue Jan 19, 2021 · 12 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@alexandrebrilhante
Copy link

alexandrebrilhante commented Jan 19, 2021

@bbc/react-transcript-editor highlights word as they are pronounced and allows to jump on a word's timestamp by double-clicking on it. Would this be possible to add this feature? Right now it jumps add the beginning of the paragraph.

@pietrop
Copy link
Owner

pietrop commented Jan 19, 2021

Thanks @brilhana 👋
Provided there's a way to introduce this feature without introducing performance issues (see bbc/react-transcript-editor#150) then a PR would be more then welcome.

As much as I'd prefer the highlights to be at word level, at the moment it is not very high in my priority list for this component as I haven't had any of users complaining about the paragraph level vs word level eg in autoEdit.io or in pietrop/digital-paper-edit-firebase.

if you or anyone else is interested in taking this on, I am happy to provide guidance and advice for a PR.

@Javeed-JargonHandlers
Copy link

Hi @pietrop

I would like to integrate the word level highlight. Could you please guide us on integrated this?

@pietrop
Copy link
Owner

pietrop commented Feb 24, 2021

👋 Hi @Javeed-JargonHandlers!
Absolutely, how familiar are you with slateJs?

One way could be to render the words as leaves in slate but this has been done by others and is not very performant for transcripts over 20min/1 hour.

But maybe there's a way to only turn this on for the current paragraph (maybe using currentTime var)?

I think best would probably be to do a little research and come up with a list of options, and then go through some pro and cons before deciding which one to try out. Unless you already have one in mind that you'd like to explore?


one crazy idea 💡 you know how in CSS you cannot select words within text inside a div (last I checked) unless is broken up into some sort of html tags like span etc... But there's the pseudo selector before and after. that maybe could be used to select/recreate and overlap all the words before within a paragraph, and eg make them of a diff color etc... may not work, but maybe worth a short.
From css class selector to select text inside a div+example

@pietrop pietrop added help wanted Extra attention is needed enhancement New feature or request labels Feb 24, 2021
@RoseVijay
Copy link

Hi @pietrop
I use slate-transcript-editor for audio transcription.
Please, could you help me on how to get the value of text on double click as well as on select from a sentence.

@pietrop
Copy link
Owner

pietrop commented Mar 1, 2021

Hi @RoseVijay
What are you trying to do?

There could be a way to do it using getSelectionNodes but it depends on the ultimate goal :)

@RoseVijay
Copy link

Hi @pietrop
I am trying to copy the text on select or on double click.
https://prnt.sc/10b3waf

@pietrop
Copy link
Owner

pietrop commented Mar 2, 2021

Ok, fine. But to do what?

cmd +c can already give you that text. What are you trying to do with it if you don't mind me asking?

Do you also need the associated time-codes or just the text?

@RoseVijay
Copy link

@pietrop
I want to get the exact text on double click or on select. I will fetch data(exact selected text) only through mouse action and not on keyboard.
By doing so, I will be performing some actions on it.
https://prnt.sc/10b3waf

@pietrop
Copy link
Owner

pietrop commented Mar 2, 2021

What actions? 🙃

For on select, you can use a modified version of getSelectionNodes and pass a callback to it from the parent component to get the selected text programmatically.

for double click, that’s easier but will only give you a single word. You can look at the onDoubleClick event and pass callback from parent the. Use modified version of getSelectedNodes to give you the text.

If that makes sense?

@pietrop
Copy link
Owner

pietrop commented May 19, 2021

This has been added in most recent version see in up to date storybook demo

❌ highlights word as they are pronounced
✅ allows to jump on a word's timestamp by double-clicking on it.

word level highlights is not present, because of trade of with performance. But open to have this open as a separate issue and consider alternatives and options that don't sacrifice performance to potentially re-introduce this feature.

@peps32
Copy link

peps32 commented Sep 17, 2021

@brilhana @Javeed-JargonHandlers @Bodawen I'm curious... did you make any progress on the "words highlighted at current time / as they're pronounced" feature?

@pietrop
Copy link
Owner

pietrop commented Sep 17, 2021

There has been some progress done here as well #75 and as mentioned there, happy to re-open this issue if there's enough interest, and I'd also welcome a PR 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

5 participants