birchill / 10ten-ja-reader

A browser extension to translate Japanese by hovering over words.
https://addons.mozilla.org/firefox/addon/10ten-ja-reader/
GNU General Public License v3.0
609 stars 45 forks source link

Using Rikaichamp with subtitles #39

Open Revolyze opened 6 years ago

Revolyze commented 6 years ago

So one of the best ways to learn Japanese is with Japanese subtitles. So I've been trying to get rikaichamp to work so people have this alternative for videos as well.

HTML5 has a 'track' element to play subtitles with videos. I'm even able to highlight and copy the subtitle text seen here: https://i.imgur.com/XB7lXzq.png

I was using https://github.com/iandevlin/iandevlin.github.io/tree/master/mdn/video-player-with-captions but a live example can be found here (no Japanese subtitles though) http://iandevlin.github.io/mdn/video-player-with-captions/

Is Rikaichamp capable of understanding subtitles with some modifications? Or is it simply not possible?

birtles commented 6 years ago

Oh yes I agree that learning from videos is great and subtitles can be very helpful. I'd never thought about supporting <track> before but that sounds like a good addition.

It appears that using the TextTrack interface it should be possible to get the currently active cues. It's not a simple fix but at first glance it looks do-able!

Unfortunately there are other fairly major bugs with rikaichamp I should fix first. Perhaps someone else might be interested in looking this before I get to it.